|
Answer» There are a few distinctions between a class in C++ and a structure. These are the following: - When creating a structure from a class or another structure, the base class or structure's default access specifier is PUBLIC. When deriving a class, on the other hand, the default access specifier is private.
- The members of a structure are always public, but the members of a class are always private.
- The variables of a structure are STORED in the STACK memory while those of the class are stored in the heap memory.
- Class supports inheritance whereas structures do not.
- The TYPE of class is reference type whereas the type of structure is a VALUE type.
|