Are methods in structs really bad and why?
>>59178578
concerning c++
final bump
1. Structs are more of a c thing, in c++ you should use classes
2. In c it is fine to have methods inside structs
Structs in C++ are only really intended for Plain Old Data
When you start adding methods to a struct it's usually a sign you're starting to make a Class
>>59178578
I don't really like it. Make it a class if it holds more than just data.
>>59178578
No, ignore these retards.
>>59180394
1. There are some uses for structs in C++. In structs everything is public by default, which I like to use if I have something that's just pure data, where every field should be accessible.
2. C doesn't have methods, only functions. And you can't have functions in structs in C, only function pointers, which is the way to do OOP in C btw.
>not using interfaces
cucks.
>>59182012
Ya I forget you have to use function pointers in c structs
>>59180394
>Structs are more of a c thing, in c++ you should use classes
the only difference between structs and classes in c++ is that classes are private by default.
There's no reason to use either by default in C++. Don't leave your accessors implicit.
>>59182012
>C doesn't have methods, only functions
C doesn't have functions, only procedures
>And you can't have functions in structs in C, only function pointers, which is the way to do OOP in C btw.
vtables are a better way to do it
>>59183033
>I don't know C
opinions discarded
>>59183048
>>59183033
>C doesn't have functions
but it does nigga