-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOOP_one.cpp
42 lines (36 loc) · 835 Bytes
/
OOP_one.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
#include<iostream>
#include<string>
using namespace std;
// OOP = Object Oriented Programming
// create object the building blocks
//Class is an blueprint: an instance of a Class
class user{
public:
string userName;
string userType;
int hp;
int mp;
int lvl;
int exp;
// Constructor
user(){
cout << "complete!"<<endl;
}
};
int main()
{
user playerOne;
playerOne.userName = "dex";
playerOne.userType = "assasin";
playerOne.hp = 123;
playerOne.mp =123 ;
playerOne.lvl = 123;
playerOne.exp = 123;
// accessing
cout << "Player Name: " << playerOne.userName << endl;
cout << "Class: " << playerOne.userType<<endl;
cout << "Health: " <<playerOne.hp<<endl;
cout << "Mana: " << playerOne.mp<<endl;
cout << "Level" << playerOne.lvl<<endl;
cout << "Experience: " << playerOne.exp<<endl;
}