class Animal
{
int age;
float height;
public:
virtualfloat Eating();
virtualvoid Sleeping();
};
Animal* animal = new Animal();
//This line crashed --v
animal->Eating();
//However I am able to view the instance in watch window as:
//But not able to identify error here.
-> vftbl
->0x00000000
->Animal::Sleeping (0x04b310a0)
It was a type error, have corrected it as class Animal. Do you mean there should be a virtual destructor here? I am not able to figure out what caused the error here.
Not random snippets taken out of context.
Meaning, if we have to guess at all the possible things you've missed out of your post but got wrong, we're likely to just come up with something which works.