#ifndef PERSON_H #define PERSON_H #include #include using namespace std; /** * Definition of a Person * identified by its name and age */ class Person { // ============================================== // data members // ============================================== protected: // name of the person (default value is empty string) string name; // age of the person (default value is 0) int age; // ============================================== // methods // ============================================== public: /** * default constructor */ Person(); /** * constructor with 2 arguments * @param n name of the person * @param a age of the person */ Person(string n, int a); /** * getter for name * @return name of the person */ string get_name(); /** * getter for age * @return age of the person */ int get_age(); /** * setter for name * @param n name of the person */ void set_name(string n); /** * setter for age * @param a age of the person */ void set_age(int a); /** * print class contents * @param output stream reference * @return output stream reference */ ostream& print(ostream& out); friend ostream& operator<<(ostream& out, Person& p) { return p.print(out); } }; #endif