Vote Up 0 Vote Down

differences between structures and classes in c++

I am such a beginner in c++ , and my first question is :
what are some differences between structs and classes in c++ or any computer language ?
plz list them all
Thank you
flag

Answers


Vote Up 0 Vote Down
Both are used for creating custom data types... the basic difference is that the default scope of data members of struct is public and in classes it is by default private....moreover you can do same things with both structs and classes
flag | link |
Vote Up 0 Vote Down
Basic difference among two is that structs r custom value types nd classes r custom reference types .. U can understand this if u knw the difference b/w value types nd reference types.
Structs r stored on stacks while classes r stored on heaps ..
flag | link |
Vote Up 0 Vote Down
struct and class both are user define data type.main difference is all data or fields in struct are public then we access outside and inside the struct but in class data are private cannot access outside the class this machanism is called encapsulation. class is powerful tool in object oriented programming.
flag | link |
Vote Up 0 Vote Down
Structs are a value data type but classes are reference data type , structs cant make a default constructor with paramerters unlike classes
flag | link |

Your Answer

Login before answering

Login with facebook