/*---- header file for class: PlayerChar by: Sharon Tuttle last modified: 2022-09-20 ----*/ #ifndef PLAYERCHAR_H #define PLAYERCHAR_H #include <string> using namespace std; // definition of the class ENDED with SEMICOLON!!!! // YES, after its closing curly brace!!! class PlayerChar { // in public:, declare the pubically-visible // parts of your class public: // convention: give header for your // constructors first // constructor: MUST be named the name of the // class, MUST have NO return type PlayerChar(); // you can have as many OVERLOADED constructor // methods as you want, as long as the // argument lists are "different enough" // CS 112 style: method parameters should NOT have // the exact same name as a data field PlayerChar(string init_name, int init_strength, double init_exp, string init_role, int init_hp); // accessor methods // should have an accessor for each data field // the user is allowed to "SEE" // class convention: start these with get_ // other common conventions: // * expect nothing // * return the current value of that data field // * usually are declared as const, // meaning using them does not change // the calling object (none of its // data fields will be changed) string get_name() const; int get_strength() const; double get_exp() const; string get_role() const; int get_hp() const; // mutator methods // provide a mutator method (or methods) // for each data field the user is // allowed to directly change // class convention: start these with set_ // other common conventions: // * expect the desired new value // * return nothing // * (NOT declared as const, they DO change // the state of the calling object!) void set_name(string new_name); void set_role(string new_role); // and I have chosen NOT to allow the // user to directly change their // strength, exp, anf hp // "other" methods /*--- signature: display_player: void -> void purpose: expects nothing, prints to the screen the characteristics of the calling player char, and returns nothing ---*/ void display_player() const; /*--- signature: player_to_string: void -> string purpose: expects nothing, and returns a string depiction of the calling player char ---*/ string player_to_string() const; // and feel free to include PUBLIC named // constants you WANT users to be able // to use // in private:, you indicate NOT-visible-to-users // of your class // CS 112 class style: declare your data fields here! // // Helpful hint: determine these FIRST, // so you know where to start in creating your // methods! private: // data fields string name; int strength; double exp; string role; int hp; // you can also define private methods // and private named constants here, // if you wish }; // <-- REMEMBER this SEMICOLON!!!!! #endif