-
Notifications
You must be signed in to change notification settings - Fork 0
Class vs struct
Martin Jean-Christio edited this page Oct 25, 2022
·
1 revision
The differences between a class and a struct in C++ is:
class:
-
classmembers and base classes/struts are private by default. - use
classwhen you make use of features such as private or protected members, non-default constructors and operators, etc.
struct:
-
structmembers and base classes/structs are public by default. - use
structfor plain-old-data structures without any class-like features;