OOPS
August 29, 2024OOPS
August 29, 2024OOPS
Question 168 |
(1) Every class containing abstract method must not be declared abstract.
(2) Abstract class cannot be directly initiated with ‘new’ operator.
(3) Abstract class cannot be initiated.
(4) Abstract class contains definition of implementation.
(1) | |
(2) | |
(2) and (3) | |
All are correct. |
• Abstract method means method without body, we can also be called as pure virtual functions.
• If a class is marked with keyword abstract then it is called an abstract class. It can NOT be instantiated by using new operator. But an abstract class can be used as the superclass reference for the subclass object.
• Abstract classes, by design, are not complete or functional. They are meant to serve as a base from which complete classes can be built, by aggregating the common members and methods that they all will need into an abstract base class, and then allowing the inheriting classes to fill out the necessary details. So abstract class can’t be instantiated
• Abstract method means method without body, we can also be called as pure virtual functions.
• If a class is marked with keyword abstract then it is called an abstract class. It can NOT be instantiated by using new operator. But an abstract class can be used as the superclass reference for the subclass object.
• Abstract classes, by design, are not complete or functional. They are meant to serve as a base from which complete classes can be built, by aggregating the common members and methods that they all will need into an abstract base class, and then allowing the inheriting classes to fill out the necessary details. So abstract class can’t be instantiated