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


Please Help Members By Posting Answers For Below Questions

What is difference between n and endl in c++?

584


Explain all the C++ concepts using examples.

684


Describe linkages and types of linkages?

563


Where and why do I have to put the "template" and "typename" keywords?

578


Difference between class and structure.

708






What is #include c++?

567


What is the main purpose of overloading operators?

586


What are disadvantages of pointers?

565


What is the maximum value of a unsigned char a) 255 b) 256 c) 128

631


Explain what you mean by a pointer.

626


Explain the operation of overloading of an assignment operator.

694


What is object oriented programming (oop)?

621


How can you link a c program with a c function?

565


Define vptr.

594


How a new element can be added or pushed in a stack?

581