Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Virtual table for the derived class which is not having any virtual function except parent class a virtual function

Is virtual table will be created for the derived class which is not having any virtual function except parent class a virtual function which is not overridden by derived class.

for ex:

class A{
public:
    virtual void show();

};

class B : public A
{

};

How about the virtual table of class B.

like image 401
Anoop Kumar Avatar asked Oct 19 '22 03:10

Anoop Kumar


1 Answers

There is no standard answer for your question. Its really depending on the compiler version. There is no standard ABI specified in C++. If you are interested deeper please take a look at "Itanium C++ ABI" or try to find the answer on your own by looking into the asembler code.

There was even a proposal to define portable ABI for C++

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4028.pdf

like image 156
CyberGuy Avatar answered Nov 14 '22 15:11

CyberGuy