+ 1
[C++] Trying to play around with classes
Sup there So i'm pretty new to OOP and i'm trying to play around with it I have done a mini shooting game around 2 player from the class made : https://pastebin.com/6m6NjYai I'm pretty noob so you guys have some ajustement to do. Btw if like the player want to add another player, do i need to create another string that store the player3 name then create a p3.name from that or i can do it directly from what the player typing ? like (p3.name = cin ?) I did not make the player 2 interact yet he he just here to take damages.
9 ответов
+ 1
@~ swim ~
And how can i make my player object global ? Like if i create another function. How can i call p1 created on the main on it ?
+ 1
@~ swim ~
Yeah i come from C and objet is not really clear for me yet. But as far as i know they are more useful than struct
0
~ swim ~ i dont get are get and set function.
0
Isnt is just faster to put the life in public and just p1.life ?