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
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?
Does c++ support exception handling?
What is a multiset c++?
What is the difference between cin.read() and cin.getline()?
Differentiate between realloc() and free().
What is a driver program?
Can I run c program in turbo c++?
Write about the local class and mention its use?
Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .
find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.
Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)
What is endl?
Write a note about the virtual member function?
What do you mean by vtable and vptr in c++?
What are pointer-to-members in C++? Give their syntax.