< Previous | Contents | Next >

Defining New Types

Whether youre talking about alien spacecrafts, poisonous arrows, or angry mutant chickens, games are full of objects. Fortunately, C++ lets you represent game entities as software objects, complete with member functions and data members. These objects work just like the others youve already seen, such as


255

256 Chapter 8 n Classes: Critter Caretaker


string and vector objects. But to use a new kind of object (say, an angry mutant chicken object), you must first define a type for it.


 

Introducing the Simple Critter ProgramDefining a ClassDefining Member FunctionsInstantiating ObjectsAccessing Data MembersCalling Member Functions