#include<iostream>
using namespace std;
class A
{
virtual void fun() {}
};
class B
{
virtual void fun2() {}
};
class C : virtual public A, virtual public B
{
public:
virtual void fun3() {}
};
int main()
{
/**
* why is the size of C 16 and not 24?
*/
cout<<sizeof(A)<<" "<<sizeof(B)<<" "<<sizeof(C);
return 0;
}
I'm confused as to why the size of C is 16 and not 24. If it inherits the virtual pointers of both class A and B, then why it does not have its own virtual pointer?