Click here to Skip to main content
15,911,711 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Really Dumb Suggestion Pin
ScottLeff28-Apr-05 16:35
ScottLeff28-Apr-05 16:35 
GeneralSo Damn Easy Pin
ursus zeta30-Apr-05 9:19
ursus zeta30-Apr-05 9:19 
GeneralRe: So Damn Easy Pin
ScottLeff1-May-05 12:00
ScottLeff1-May-05 12:00 
Generalsorry Pin
ursus zeta4-May-05 9:22
ursus zeta4-May-05 9:22 
GeneralPointer to managed object <undefined> off timer thread Pin
Anonymous26-Apr-05 10:23
Anonymous26-Apr-05 10:23 
GeneralRe: Pointer to managed object <undefined> off timer thread Pin
Anonymous26-Apr-05 16:59
Anonymous26-Apr-05 16:59 
Questiongarbage collection fails? Pin
cchere23-Apr-05 13:04
cchere23-Apr-05 13:04 
GeneralBaseClass Interaction Problem Pin
classsystem23-Apr-05 5:21
sussclasssystem23-Apr-05 5:21 
BaseClass Interaction Problem

    I have searched a lot on this problem to be able to resolve it, but have not found much more thing for and no solution was working like what I wanted.

My problem is this:

    I have a program that have multiple class and I need a solid interaction between every class. To do it, I use FDataManager to stored all my data. When I need to get back the data and that I know which type is it, I can go though and process it. For that purpose, I use class, baseclass, friend and function overloading.
class CClassA
{
protected:
	int VariableA
public:
	CClassA() {};

	friend FDataManager& operator>>( FDataManager& Ar, CClassA*& data )
	{
		Ar >> data->VariableA;

		return Ar;
	};
};
class CClassB
{
protected:
	int VariableB
public:
	CClassB() {};

	friend FDataManager& operator>>( FDataManager& Ar, CClassB*& data )
	{
		Ar >> data->VariableB;

		return Ar;
	};
};

class CClassC : public CClassA, public CClassB
{
public:
	CClassC() {};

	friend FDataManager& operator>>( FDataManager& Ar, CClassC*& data )
	{
		Ar >> (CClassA*&)data >> (CClassB*&)data;

		return Ar;
	};
};
My problem is at line :
Ar >> (CClassA*&)data >> (CClassB*&)data;
I can solve it by doing this:
CClassA* data1 = (CClassA*)data;
CClassB* data2 = (CClassB*)data;
Ar >> data1 >> data2;
But I don't like that last solution. I need something similar at what I have done first. Also, yes (CClassA*&)data will work, but each time you will use it, you will get data corruption for all data that have stored in before.

Anyone have an idea?
GeneralRe: BaseClass Interaction Problem Pin
toxcct26-Apr-05 0:40
toxcct26-Apr-05 0:40 
GeneralRe: BaseClass Interaction Problem Pin
classsystem1-May-05 5:29
sussclasssystem1-May-05 5:29 
GeneralRe: BaseClass Interaction Problem Pin
toxcct1-May-05 19:59
toxcct1-May-05 19:59 
GeneralRe: BaseClass Interaction Problem Pin
classsystem2-May-05 15:56
sussclasssystem2-May-05 15:56 
GeneralRadioButtons and Groups Pin
Yaron Abershitz19-Apr-05 2:45
Yaron Abershitz19-Apr-05 2:45 
Generalsearching a map Pin
{cellardoor}16-Apr-05 13:03
{cellardoor}16-Apr-05 13:03 
GeneralRe: searching a map Pin
Christian Graus17-Apr-05 17:43
protectorChristian Graus17-Apr-05 17:43 
General_MM_SHUFFLE question Pin
swati2415-Apr-05 23:09
swati2415-Apr-05 23:09 
GeneralClear the screen Pin
Larsson14-Apr-05 21:10
Larsson14-Apr-05 21:10 
GeneralRe: Clear the screen Pin
IdUnknown15-Apr-05 15:23
IdUnknown15-Apr-05 15:23 
General2005 Beta-1 C++/CLI Pin
TFB14-Apr-05 7:30
TFB14-Apr-05 7:30 
GeneralRe: 2005 Beta-1 C++/CLI Pin
Sheng Jiang 蒋晟20-Apr-05 12:33
Sheng Jiang 蒋晟20-Apr-05 12:33 
GeneralRe: 2005 Beta-1 C++/CLI Pin
TFB21-Apr-05 6:58
TFB21-Apr-05 6:58 
GeneralMicrosoft Word - Read Only and DisplayAlerts Ignored (important) Pin
User 172888413-Apr-05 23:43
User 172888413-Apr-05 23:43 
GeneralRe: Microsoft Word - Read Only and DisplayAlerts Ignored (important) Pin
ursus zeta14-Apr-05 10:04
ursus zeta14-Apr-05 10:04 
GeneralAccess Denied Reading Registry Pin
rexpiper13-Apr-05 7:25
rexpiper13-Apr-05 7:25 
GeneralRe: Access Denied Reading Registry Pin
rexpiper13-Apr-05 7:37
rexpiper13-Apr-05 7:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.