Here I'd like to quote a segment of code from Thinking In C++ (a book writen
by Bruce Eckel) to expain my question.
class Pet
{
public:
virtual void speak() const = 0;
virtual void eat() const = 0;
};
class Dog : public Pet {
public:
void eat() const {}
};
int main()
{
// Dog g;
}
If I define an object of class Dog and compile it, it must be an error, 'cos
I don't define another one in class Dog, but I consider that whether the
compiler should tell me what is wrong when I don't define object "d". Because
I always feel that the current state of class Dog is like a trap, and it
doesn't have any meaning . Am i right?
I think it is like a trap, please see this inheritance.
class Labrador_Retriever : public Dog
{
public:
void eat() {}
};
if I just inherite from base class and I don't define it's object, that
means I can't find my error till the very time. I think that's amazing.
Thank you for your help
Lorry