Double abstract class Inheritance concern.

Alexandre Oliva aoliva@redhat.com
Mon Mar 29 15:15:00 GMT 2004


On Mar 28, 2004, Tiago Stein <tiago@lisha.ufsc.br> wrote:

> class A{ };
> class B :public A{ };
> class C: public A{ int g; };
> class D: public B, public C { unsigned int foo; };

> Why sizeof class D is 12? Should not be 8? Why the extra size from the
> empty classes is not eliminated this time? Is this due to any rules in the
> standard?

D::B::A and D::C::A must have different addresses.

-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}



More information about the Gcc mailing list