Originally Posted by
CornedBee
Public and private inheritance share pretty much nothing, conceptually. Public inheritance is a subtype relationship requiring substitutability. To put it in terms of Coplien, it's a form of positive variance. Public bases are part of the interface of a class.
Private inheritance is strictly an implementation detail. It is absolutely no business of any other code that a class privately inherits something. Private inheritance is merely a convenience over containment and implementation in terms of a single subobject.
Sorry if this sounds kind of dumb, but are you saying that if I use private inheritance then the child class will not inherit any of its parents variables?
Also , I'm still having problems with these pointers . Once again the notes I got don't cover dynamic objects created within objects. I guess maybe I need a book :P
I'm trying to get the pointer to the guest staying in a room. Heres my get member function:
Code:
guests rooms::GetGuest(){return *p;}
And heres where I call it:
Code:
void CheckAvail(rooms *room)
{
for(int i=1; i<=num_rooms; i++)
{
cout << "Room: " << room[i].GetNumber() << " \tat $" << room[i].GetCost() << "\t";
if(room[i].GetGuest() != NULL)
cout << "Booked\n";
else
cout << "Vacant\n";
}
}
When I run the prog I get this error at the IF statement:
Code:
no match for 'operator!=' in 'rooms::GetGuest()() != 0'
Could someone please point out whats wrong here. Thx.