Skip to content

Commit f592291

Browse files
committed
Add Classes vs Structs in C++
1 parent 0aab657 commit f592291

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

HelloWorld/src/Main.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ class Player
1515
}
1616
};
1717

18+
struct Vec2
19+
{
20+
float x, y;
21+
22+
void Add(const Vec2& other)
23+
{
24+
x += other.x;
25+
y += other.y;
26+
}
27+
};
28+
1829
int main()
1930
{
2031
Player player;

0 commit comments

Comments
 (0)