Posts

Showing posts from November, 2022

Difference between Structure and Class in C++

  Difference between Structure and Class in C++  Members of Structure are public by default and members of Class are private by default. Structures are value types and Classes are reference types (A variable of structure type contains the Structure's data but a class variable contains the reference of the data). Structures use stack allocation; Classes use heap allocation.  When deriving a struct from a class/struct, default access specifiers for base class/struct are public.