...
OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024

OOPS

Question 168
Which of the following statements is correct?
(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.
A
(1)
B
(2)
C
(2) and (3)
D
All are correct.
Question 168 Explanation: 
• Abstract class may consist of at least one abstract method.

• 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

Correct Answer: C
Question 168 Explanation: 
• Abstract class may consist of at least one abstract method.

• 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

Leave a Reply

Your email address will not be published. Required fields are marked *