Virtual base class and virtual table

1. Objects store data members.
2. Non-virtual inheritance merges data members of every involved class to create an object.
3. Virtual inheritance merges only a single copy of each virtual base into an object.
4. A non-virtual member function is basically an access-restricted non-member function.
5. Virtual member functions use a "virtual table" which references appropriate member functions corresponding to the dynamic type of an object.
6. Virtual member functions may incur both a size and performance cost due to the "virtual table".

No comments:

Post a Comment