What is the difference between Class and Structure?

Answer Posted / navin

Structure: Initially (in C) a structure was used to bundle
different type of data types together to perform a
particular functionality. But C++ extended the structure to
contain functions also. The major difference is that all
declarations inside a structure are by default public.
Class: Class is a successor of Structure. By default all
the members inside the class are private.

Is This Answer Correct ?    182 Yes 55 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is a class? Explain with an example.

621


What is iterator in c++?

621


What is a far pointer? where we use it?

619


What are the advantages of using const reference arguments in a function?

622


How a macro differs from a template?

637






What are guid? Why does com need guids?

570


What is a static member?

618


You run a shell on unix system. How would you tell which shell are you running?

663


What does the linker do?

597


what is c++

1804


What are formatting flags in ios class?

610


what is C++ exceptional handling?

633


Do inline functions improve performance?

650


What is a forward referencing and when should it be used?

581


What is dev c++ used for?

605