-
Notifications
You must be signed in to change notification settings - Fork 0
/
class.cpp
49 lines (41 loc) · 966 Bytes
/
class.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include<iostream>
#include <string>
#include <vector>
using namespace std;
class Player
{
public:
string name;
int health;
int xp;
void talk(string text_to_say){
cout<<name<< "says"<<text_to_say<<endl;
}
bool is_dead();
};
class Account{
public:
string name{"Ajay"};
double balance {0.0};
bool deposit(double bal);
bool withdraw(double bal);
};
int main()
{
Player frank;
frank.name = "frank";
frank.health = 100;
frank.xp = 12;
frank.talk("hi there!");
/* Player hero;
Player players[] {frank,hero};
vector<Player> player_vec{frank};
player_vec.push_back(hero);*/
Player *enemy = new Player;
(*enemy).name = "Enemy";
(*enemy).health = 100;
enemy->xp= 15;
enemy-> talk("i will eat your pussy");
delete enemy;
return 0;
}