What is the difference between Class and Structure?
Answer Posted / guest
(1)Class Design For Object , Struct Design For Value Thus
Class is Refrence Type (Heape) but Struct is Value Type
(Stack) And Thus Struct is Faster Than Class ,
(2) Class is not Accessable Meanning We Can Access it By
Object , Struct is Accessable Meanning We Can Access it By
Value (Varible).
(3) Class Support Inheritance , Struct Not Support Inheritance .
(4)Class id Added Behavior (Methods) , Struct Not Added
Behavior
(5)Class Exist at higher Level of the Program , Struct Exist
at Lowest Level of the Program .
(6) A struct cannot declare a default constructor (a
constructor without parameters) or a destructor.Class Can .
(7)a small class may be more efficiently handled by the
system if you declare it as a struct instead.
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What is new in c++?
What do you mean by vtable and vptr in c++?
What is auto type c++?
How many types of modularization are there in c++?
Why c++ is not a pure oop language?
Write about an iterator class?
How can you quickly find the number of elements stored in a static array?
What is an undefined reference/unresolved external symbol error and how do I fix it?
What does the nocreate and noreplace flag ensure when they are used for opening a file?
What are the main features of c++?
Explain the difference between realloc() and free() in c++?
Which operator cannot overload?
Tell me an example where stacks are useful?
Explain the pure virtual functions?
What are pointer-to-members? Explain.