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 do you mean by volatile and mutable keywords used in c++?
What is the difference between a reference and a pointer?
Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c
Can non graphic characters be used and processed in C++?
What is the difference between the functions rand(), random(), srand() and randomize()?
What is lambda in c++?
What are all predefined data types in c++?
What is using namespace std in cpp?
What is a container class? What are the types of container classes in c++?
What is implicit conversion/coercion in c++?
What is a memory leak c++?
What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0
What are guid?
What is pointer in c++ with example?
What does the linker do?