I'm sorry, guys if i cann't post my code it's written in my language, but the problem looks like this i have 5 classes, two base and the others derive those two, CPark, derives from CFloor, and this one derives from CPlaces, that derive CData and Ctax... Let write a simple code;
class CData:
{
protected:
int year;
int month;
public:
//methods to use these members
};
class CTax:
{
protected:
int cents;
int euros;
public:
CData(int year,int month);
//methods to use these members
};
class CPlaces: public CData, CTax
{
public:
CPlaces *Array_Places[6];
CData *date;
};
class CFloor: public CPlaces, CData, CTax
{
public:
CFloor *Array_Floors[4];
};
/*
I can save the data using the pointers like
in a method of CPark*/
void CPark::Insert_Car()
{
int Year;;
int Month;
cin >> Year;
cin >> Month;
/*but if i want to access them to eco in the screen i can't access menbers of CData i know that if they're declared as public i can access them but i want to keep them protected to do this.*/
void CPark::showonscreen()
{
//Like this i can't access menber year.
cout << Array_Floors[0]->Array->Places[0]->date->Year;
//Like this i need a class tipe specifier on Array_Floors
cout << Array_Floors[0]->Array->Places[0]->date.Year;
}
Somebody there help me i want to keep the menbers in CData protected...
I'm not entirely sure what you want to do especially since im reading it black on white which hurts my eyes a lot, so all i really know is that you want access rights to something... I think you want to use friend (unless i misinterpreted your question). That way ONLY CPark::showonscreen() and others that you shared access with will have access to the members. In other words, it stays protected but adds an exception.