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
an operation between an integer and real always yeilds a) integer result b) real result c) float result
What is friend class in c++ with example?
What is polymorphism in c++? Explain with an example?
What are the uses of typedef in a program?
How many keywords are used in c++?
What is singleton pattern in c++?
What do the keywords volatile and mean mutable?
What is a static member?
What new()is different from malloc()?
Ask to write virtual base class code?
How to defines the function in c++?
What happens when the extern "c" char func (char*,waste) executes?
How many namespaces are there in c++?
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
Explain the concept of friend function in c++?