I'm *positive* someone has asked this before...but I couldn't find it in the search, sorry, so I'm asking again.
I have a base class called Object, with the following constructor:
Object.cpp:
All those variables that are modified there are PRIVATE Object variables.Code:Object::Object() { burnable = false; edible = false; equipable = false; wearable = false; keyID = -1; // not a key lockID = -1; // not a lock name = "New Object."; floorDescription = "A dusty new object lies on the floor."; }
Now, I have a class Container, which is an extention of Object. I do the following:
Container.h:
Container.cpp:Code:class Container : public Object
This is to avoid resetting all the params to default values again in the Container constrcturo. This works fine, except when I try to modify floorDescription and name (private fields in Object class), I get the following errors:Code:Container::Container() { Container::Object(); floorDescription = "You spy a new container lies here."; name = "New Container"; isOpen = false; }
std::string Object::floorDescription' is private Object.h
std::string Object::name' is private Object.h
Any ideas?