I am learning about virtual functions and abstract classes and it seems that I have a difficulty in comprehending something. Let's say I have this code:
class animal {
public:
virtual void show()=0;
};
class dog : public animal {
int weight;
};
int main()
{
//animal a;
dog d;
return 0;
};
I understand how animal a is incorrect because the animal class is abstract and I am not allowed to declare objects of this class. However, why the dog d is also incorrect? (given that the class dog is not abstract and so I can declare dog objects)
Thanks in advance!!