I am thinking up an idea in my head for the design of how I am going to manage my environment. Basically I want to create an easy to use system for adding areas to a world etc and was curious to have some feedback.
The idea is to have concepts of a World, continents, zone, etc. I was wondering if I should use inheritence like so
class World {};
class Continent: public World {};
class Zone: public Continent {};
Or would it go the other way around:
class Zone();
class Continent: public Zone {};
class World: Continent {};
The other way, is iwth no inheritence and each class just holds a contain that has all of its children in it.
What do you think?
World design help?
Whaaa?The reason why thinking inheritance would help would be in a case such as the position of the world changed, every child item would move with it, etc.
Why would the world need to move
Working on game: Marrbles (Currently stopped).
freezzo,
If we talk about class organization, i would probably did something next:
class zone; // abstract or interface
class indoor : zone; // like cave, house ... or if i need more, i would "class house:indoor;", "class cave:indoor;" and so on.
class outdoor : zone; // like street, airport or a beach
The collection of this zones like continents and world, can be achieved next way:
class region; // this class manages collection of zones (usual this zones are close to each other, but that is not a restriction)
class continent; // ......... manages collection of regions
class world; // ................. manages collection of continents
If we talk about class organization, i would probably did something next:
class zone; // abstract or interface
class indoor : zone; // like cave, house ... or if i need more, i would "class house:indoor;", "class cave:indoor;" and so on.
class outdoor : zone; // like street, airport or a beach
The collection of this zones like continents and world, can be achieved next way:
class region; // this class manages collection of zones (usual this zones are close to each other, but that is not a restriction)
class continent; // ......... manages collection of regions
class world; // ................. manages collection of continents