Class Versus Struct
Posted
by
Prometheus87
on Programmers
See other posts from Programmers
or by Prometheus87
Published on 2011-07-30T09:56:32Z
Indexed on
2012/03/19
10:17 UTC
Read the original article
Hit count: 242
c++
|object-oriented
In C++ and other influenced languages there is a construct called Structure (struct
) and we all know the class
. Both are capable of holding functions and variables. some differences are
1. Class is given memory in heap and struct
is given memory in stack
2. in class variable are private by default and in struct
thy are public
My question is that struct
was somehow abandoned for Class. Why? other that abstraction, a struct
can do all the same stuff a class does. Then why abandon it?
© Programmers or respective owner