What is the difference between Class and Structure?
Answer Posted / sudip das.
The difference between a CLASS and STRUCTURE are that:
1) CLASS are reference type where as STRUCTURE are value type.
2)By default,all of the members of a CLASS are private, but all of the members of a STRUCTURE are public.
3)CLASSES use heap but STRUCTURE use stuck.
4)CLASS members can be declared as protected but STRUCTURE members can not be.
5)CLASS contain data members and member function, but a STRUCTURE is contain only data member.
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
What is the protected keyword used for?
How new/delete differs from malloc()/free?
What is #include math h in c++?
We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?
What is the use of seekg in c++?
How is new() different from malloc()?
Can comments be longer than one line?
How do you sort a sort function in c++ to sort in descending order?
Does c++ have finally?
What is a catch statement?
Write a program to add three numbers in C++ utilizing classes.
We use library functions in the program, in what form they are provided to the program?
what are the iterator and generic algorithms.
What is the difference between structures and unions?
What is class and structure in c++?