In C++ and other influenced languages there is a construct called Structure (struct
), and another called the class
. Both are capable of holding functions and variables. Some differences are:
- Class is given memory in the heap and
struct
is given memory in the stack (remark: this is wrong for C++, but maybe correct in what the OP called "influenced languages") - Class variable are private by default and in
struct
they are public
My question is: was the struct
somehow abandoned for Class? If so, why? Other than the differences above, a struct
can do all the same things that a class does. So why abandon it?