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
55public:
66 float X, Y;
77
8- Entity ( )
8+ void Move ( float xa, float ya )
99 {
10- X = 0 .0f ;
11- Y = 0 .0f ;
12- std::cout << " Created Entity!" << std::endl;
10+ X += xa;
11+ Y += ya;
1312 }
13+ };
1414
15- ~ Entity()
16- {
17- std::cout << " Destroyed Entity! " << std::endl;
18- }
15+ class Player : public Entity
16+ {
17+ public:
18+ const char * Name;
1919
20- void Print ()
20+ void PrintName ()
2121 {
22- std::cout << X << " , " << Y << std::endl;
22+ std::cout << Name << std::endl;
2323 }
2424};
2525
26- void Function ()
27- {
28- Entity e;
29- e.Print ();
30- }
31-
3226int main ()
3327{
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 ;
3534
3635 std::cin.get ();
3736}
You can’t perform that action at this time.
0 commit comments