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 to implement is-a and has-a class relationships?
Explain the uses of static class data?
Write a program to find the Factorial of a number
Why is c++ still best?
What is token c++?
What are libraries in c++?
Differentiate between C and C++.
How are Structure passing and returning implemented by the compiler?
What does return 0 do in c++?
What is copy constructor? Can we make copy constructor private in c++?
How many keywords are used in c++?
How much maximum can you allocate in a single call to malloc()?
What are structures and unions?
What is expression parser in c++
What is the function to call to turn an ascii string into a long?