Problems with multiple inheritance

Pascal Francq pfrancq@ulb.ac.be
Wed Jul 16 12:24:00 GMT 2003


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



More information about the Gcc mailing list