The only thing that class and struct is different from C ++ is the default interface. if you write:
struct MyStruct { int a; }
and
class MyClass { int a; }
the only difference is the field a in both cases. The field MyStruct a open, and the field MyClass a is private. Of course, you can manipulate them using public and private keywords in structures and classes.
If you are programming in C ++, you should use classes.
source share