We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 363883d commit 3613865Copy full SHA for 3613865
1 file changed
HelloWorld/src/Main.cpp
@@ -5,33 +5,32 @@ class Entity
5
public:
6
float X, Y;
7
8
- Entity()
+ void Move(float xa, float ya)
9
{
10
- X = 0.0f;
11
- Y = 0.0f;
12
- std::cout << "Created Entity!" << std::endl;
+ X += xa;
+ Y += ya;
13
}
+};
14
15
- ~Entity()
16
- {
17
- std::cout << "Destroyed Entity!" << std::endl;
18
- }
+class Player : public Entity
+{
+public:
+ const char* Name;
19
20
- void Print()
+ void PrintName()
21
22
- std::cout << X << ", " << Y << std::endl;
+ std::cout << Name << std::endl;
23
24
};
25
26
-void Function()
27
-{
28
- Entity e;
29
- e.Print();
30
-}
31
-
32
int main()
33
34
- Function();
+ std::cout << sizeof(Entity) << std::endl;
+ std::cout << sizeof(Player) << std::endl;
+
+ Player player;
+ player.Move(5, 5);
+ player.X = 2;
35
36
std::cin.get();
37
0 commit comments