This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problems with multiple inheritance


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]