Description
Use Linux to create a user-defined Abstract Data Type (ADT) using C++ classes named Warrior and View along with an appropriate set of C++ header/implementation files as discussed in class. • The Warrior class describes the current state of an individual Warrior class instance. • The View class displays the current state of an individual Warrior class instance. • The Warrior and View classes define the CharacterNS namespace. o The Warrior and View classes do NOT use this namespace.
The View class needs to see the Warrior class, but the Warrior class does not need to see the View class.
The UML diagram does not show: • access specifies: public, protected, private • default values: arguments, attributes, … • use of the const keyword • function inlining implementations: explicit, implicit • enumeration implementations: public, private
The Warrior/View ADT must define and implement the following data types and operations. • Do not add to or modify the public interface (exportable components – public components). • Do not add to or modify any attributes or data types (storage components). Warrior class Exportable Operations: (declared .h file and defined .cpp file) Warrior default/overloaded/parameterized constructor • 150 is the default lifeForce value • 25 is the default resistance value • SWORD is the default equipped weapon • MALE is the default gender Warrior copy constructor – creates an exact copy of an existing Warrior class instance ~Warrior destructor – displays the message: Warrior class instance destroyed setters each private attribute is supported by an appropriate standard setter method exception gender – see GenderType use explicit function inlining implementation techniques getters each private attribute is supported by an appropriate standard getter method exception gender – see GenderType use explicit function inlining implementation techniques
Warrior class User-Defined Data Types: GenderType FEMALE, MALE use private enumeration implementation techniques use implicit function inlining implementation techniques WeaponType DAGGER, MACE, SWORD use public enumeration implementation techniques
View classes Exportable Operations: (declared .h file and defined .cpp file) View default constructor View overloaded/parameterized constructor – accepts a Warrior class instance View copy constructor – creates an exact copy of an existing View class instance ~View destructor – displays the message: View class instance destroyed setWarrior Warrior class instance to be viewed implemented using the Warrior class setters and getters viewWarrior displays the state of the currently contained Warrior class instance on the screen
viewWarrior

