Just to add:
Your SimpleClass base class will need a virtual destructor if you plan on doing something like this:
If SimpleClass does not have a virtual destructor, and you are destroying the object through a pointer to base, the behavior is undefined.Code:// Test.cpp
int main(int argc, char* argv[])
{
// complains about this ?!
SimpleClass *notworking = new DerivedSimpleClass();
cout<<notworking->getContent();
delete notworking; // undefined behavior
}
Regards,
Paul McKenzie
