25年4月3日

1.思维导图

25年4月3日_第1张图片

2. 25年4月3日_第2张图片

3.


#include 
#include 
#include 
#include 
#include 
#include 
#include 
 
using namespace std;
 
class Hero{
private:
    int atk;
    int def;
    int spd;
    int hp;
public:
    Hero(int a,int d,int s,int h):atk(atk),def(def),spd(spd),hp(hp)
    {
        atk=a;
        def=d;
        spd=s;
        hp=h;
    }
 
    void set_atk(int val){atk+=val;}
    void set_def(int val){def+=val;}
    void set_spd(int val){spd+=val;}
    void set_hp(int val){hp+=val;}
 
    int get_atk(){return atk;}
    int get_def(){return def;}
    int get_spd(){return spd;}
    int get_hp(){return hp;}
 
    void equipWeapon(class Weapon * w);
 
    void show()
    {
        cout<<"atk= "<

你可能感兴趣的:(c++)