What is the difference between Class and Structure?
Answer Posted / sundarchum
Structs are Value type. They are stored as a stack on
memory.
Class is reference type. They are stored as heap on memory.
Sturcts constructor must contain a parameter and cannot
have default constructor.
Class constructor may contain no parameter.
Struct cannot have instance field.
Class can have instance field.
Struct cannot inherit from a structure.
Class can inherit from a class.
Structs cannot declare a destructor.
| Is This Answer Correct ? | 101 Yes | 49 No |
Post New Answer View All Answers
How can I learn c++ easily?
What is a pdb file?
What is input operator in c++?
Explain what are single and multiple inheritances in c++?
Difference between overloaded functions and overridden functions
What is a wchar_t in c++?
How many types of modularization are there in c++?
List the special characteristics of constructor.
Write a program which employs Recursion
What is iterator in c++?
How do you flush std cout?
Do you know about C++ 11 standard?
When do you call copy constructors?
How did c++ start?
What are protected members in c++?