What is the difference between Class and Structure?

Answer Posted / prince rupela

1.Structure is Value Type. Class is a reference type.
2.Structure Contain Data Member. Class Contain Data Member And Member Function.
3.In Structure Data Members are By Default Public. In Class Data Member are By Default Private
4.Structure can not Inherit. Structure can Inherit.
5.There is no Data Hiding Feature in Structure. In Class There is Data Hiding features like Public,Private, Protected.
6.A Structure Can't Abstract . Class can.
7.Structure both use c and c++. class only c++ and oops language.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does c++ support multilevel and multiple inheritances?

552


Is c++ the best programming language?

542


What is the main function c++?

604


What is general format for a prototype?

601


Explain mutable storage class specifier.

637






What is a dynamic binding in c++?

538


Explain what happens when a pointer is deleted twice?

735


what is data encapsulation in C++?

607


Why is main function important?

587


How do I get good at c++ programming?

602


What are c++ storage classes?

622


If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?

671


What is virtual destructor ans explain its use?

608


Write bites in Turbo c++ Header ("Include") Files.

690


If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?

551