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

If a function doesn’t return a value, how do you declare the function?

603


program explaining feautures of c++

1908


Can constructor be static in c++?

630


What is the meaning of string in c++?

562


Why do we need templates?

534






What are structures and unions?

561


What is a singleton class c++?

538


What is an inline function in c++?

615


What is double in c++?

553


How does work in c++?

583


Refer to a name of class or function that is defined within a namespace?

588


Why null pointer is used?

571


What are the 2 main types of data structures?

578


Does dev c++ support c++ 11?

542


Can I uninstall microsoft c++ redistributable?

595