Does a pure-virtual object possess a pointer towards the vtbl? (that most likely indicates NULL?)

thanks, i am a tiny bit confused with the virtual mechanism.

Don't be concerned about this. Virtual tables are an implementation detail, and aren't even certain to exist. The greater you are worried about how exactly it may be done, the less you find out about the actual language.


Nevertheless, yes. A concrete class will set that pointer to suggest towards the correct virtual table.

There is not technically this type of factor like a 'pure-virtual object'. I suppose you mean an item with pure-virtual techniques? However, you can't really create this kind of object because it might be abstract and also the compiler would complain.

With that said, as the object has been built it's briefly a clear case of the abstract class before becoming a clear case of the derived class. It'll in this situation possess a virtual table set the functions it defines. It'll most likely have NULL for that pure virtual techniques. By trying calling the program will crash.

You can test this out by calling virtual techniques within the constructor. You will find they invoke the bottom class version should you call the techniques within the base class. Should you call a pure virtual method it'll crash. (In some instances the compiler will determine your work and complain rather).

The collect is:

Don't call virtual functions inside your constructor, its just apt to be confusing. Actually, generally it's best in case your constructor just sets its internal status up and doesn't do anything whatsoever too complicated.