This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Problems with multiple inheritance
- From: Pascal Francq <pfrancq at ulb dot ac dot be>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 16 Jul 2003 12:01:07 +0200
- Subject: Problems with multiple inheritance
- Organization: Université Libre de Bruxelles
Hi,
I have the following problem with classes:
class A
{
public:
B* ptr;
void Set(B* p)
{
ptr=p;
}
};
class MyClass : public dummy, public B
{
public:
void Init(A* a)
{
a->Set(this);
}
}
When I debug the class 'MyClass' in method 'Init', the class is OK, i.e. the
information of the two classes 'dummy' and 'B' are set correctly. When I pass
the class to the method 'Set' of 'A', all the elements inherits from B are
not correctly set. I have try to use static_cast to force the pointer of
'MyClass' to be a 'B*' in the Init method, but it does not work also.
Any ideas?
--
Dr Ir Pascal Francq
Researcher
Université Libre de Bruxelles
CAD/CAM Department
Avenue F.D. Roosevelt, 50
CP 165/14
B-1050 Brussels
BELGIUM
Tel. +32-2-650 47 65
Fax +32-2-650 47 24
ICQ: 91206668