Hi, all:

I compiled the following code using g++-2.95:
---------------------------------------------------------------------
#include <iostream>
using namespace std;

class A {
public:
    virtual void echo () {};
};

class B: public virtual A {
public:
    int b;
    virtual void echo () {};
};

int
main()
{
    cout << sizeof(A) << endl;
    cout << sizeof(B) << endl;

    return 0;
}
--------------------------------------------------------------------
The result is:
4
12


If I compile it using g++-3.3.5, the result is:
4
8

So I am wondering whether g++-3.3.5 changes its object model.



-------------------
Holderlin Zhang
Department of Applied Math., Nankai University

Reply via email to