For my C++ friends. Which do you prefer and why?
21% Struct
79% Class
66 votes • Final results
14
1
8
Totally depends of what it means to be use :) Struct and Class are the same thing in the end with C++
1
1
But you cant have any method in structs 😊
2
What do you mean? You can definitely add methods to structs
1
This works just fine

Jan 16, 2022 · 2:20 AM UTC

1
1
AH. Wth. I dont think i have seen any language accepting that. So i understand your point. Struct comes from C for handling complex data, so even if this works, i still recommend classes for "living" objects and structs for data only 😅
1
1
I agree with Infokub, and using methods in a struct can be a good way to return special data from what is inside the struct, and you can also overload operators (which can be useful to compare/sort/whatever structs data!)
1