What must a derived class generally do to become a concrete class when inheriting from an abstract class?
class Base
{
public:
virtual void show() = 0;
};
class Derived : public Base
{
public:
void show() override
{
cout << "Derived";
}
};
Options
-
A.
Implement all inherited pure virtual functions.
-
B.
Delete the base class.
-
C.
Make all functions static.
-
D.
More than one of the above
-
E.
None of the above
Correct Answer (Detailed Explanation is Below)
A.
Implement all inherited pure virtual functions.
Detailed Explanation
Answer: (A) Implement all inherited pure virtual functions.
If a derived class inherits a pure virtual function and does not provide an implementation for it, the derived class also remains abstract.
To become a concrete class that can be instantiated, the derived class must implement all inherited pure virtual functions that are required.
In the example, Derived implements show(), so it can be instantiated.