'Why is the size of class E 24 bytes in c++
#include <iostream>
using namespace std;
class A{
public:
int a;
};
class B: virtual public A{};
class C: virtual public A{};
class X{
public:
int c;
};
class D: public B, public C{
};
class E: public D, virtual public X{
};
class F:virtual public X{
};
int main() {
cout <<sizeof (E) << endl;
return 0;
}
b inherits a,c inherits a,d inherits b and c,e inherits d and x Why is the size of class E 24 bytes in c++ GCC+MinGW-w64 compiler for Windows
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
