C++ Structures | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ Structures

Do you find C++ structures useful in any application? Or is it best to use classes?

19th Jul 2022, 10:37 PM
Red Hawks
Red Hawks - avatar
1 Answer
+ 1
Technically there is only one difference between classes and structs and that is that members are by default public in structs where as they are private by default in classes. Practically i like to use structs to bundle/store/organize data. For example i might have a book struct if i only intend to store data there. Classes i use for actors and things that have methods/functionality. Like for example a player class for a game.
19th Jul 2022, 11:38 PM
Erarnitox
Erarnitox - avatar