File tree Expand file tree Collapse file tree 1 file changed +16
-17
lines changed Expand file tree Collapse file tree 1 file changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -5,33 +5,32 @@ class Entity
5
5
public:
6
6
float X, Y;
7
7
8
- Entity ( )
8
+ void Move ( float xa, float ya )
9
9
{
10
- X = 0 .0f ;
11
- Y = 0 .0f ;
12
- std::cout << " Created Entity!" << std::endl;
10
+ X += xa;
11
+ Y += ya;
13
12
}
13
+ };
14
14
15
- ~ Entity()
16
- {
17
- std::cout << " Destroyed Entity! " << std::endl;
18
- }
15
+ class Player : public Entity
16
+ {
17
+ public:
18
+ const char * Name;
19
19
20
- void Print ()
20
+ void PrintName ()
21
21
{
22
- std::cout << X << " , " << Y << std::endl;
22
+ std::cout << Name << std::endl;
23
23
}
24
24
};
25
25
26
- void Function ()
27
- {
28
- Entity e;
29
- e.Print ();
30
- }
31
-
32
26
int main ()
33
27
{
34
- Function ();
28
+ std::cout << sizeof (Entity) << std::endl;
29
+ std::cout << sizeof (Player) << std::endl;
30
+
31
+ Player player;
32
+ player.Move (5 , 5 );
33
+ player.X = 2 ;
35
34
36
35
std::cin.get ();
37
36
}
You can’t perform that action at this time.
0 commit comments