In the following example, the class Base is an abstract class. the Derived class inherits from a Base class. I don't override the pure virtual function in derived class. Then, I have been trying to create derived class object, but the compiler gives following error.
error: cannot declare variable 'd' to be of abstract type 'Derived'
Derived d;
Code here:
#include<iostream>
using namespace std;
class Base
{
public:
virtual void show() = 0;
};
class Derived : public Base
{
};
int main(void)
{
Derived d;
return 0;
}
Why Derived class also become abstract class?