Question
Your solution should include at least the following OO features:
• data hiding / encapsulation
• polymorphism / inheritance / "is a"
• member "has a" relationship with a non-trivial object (Box "has a" left, but double is a trivial type so that wouldn't count)
• pointer "has a" relationship with a non-trivial object (Polygon "has a" pts, but double[] is a trivial type so that wouldn't count)
• "knows a" relationship (with a non-trivial, non-owned object)
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
#ifndef CHARATER_H#define CHARATER_H
#include<string>
using namespace std;
class Charater {
public:
Charater();
Charater(const Charater& orig);
Charater(string & n, int & h, int & p, int & a);
virtual ~Charater();
virtual int hit() = 0; // attack, return attack power
virtual void getHit( int & p) = 0 ; // pure virtual method
bool isDied() ;
string getName();
protected:
string name;
int health;
int initPower;
int armor;
};
#endif /* CHARATER_H */...