What are the differences between a struct and a class in
C++?

Answer Posted / ajit

In structures by default the member variables considered as
public where as in classes by default data members are
considered as private.
Structures doesn't provide the concept data encapsulation
but classes provides it.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data types c++?

526


Can I learn c++ without c?

580


Which is not a valid keyword a) public b) protected c) guarded

715


Does c++ cost money?

556


What can I safely assume about the initial values of variables which are not explicitly initialized?

595






By using c++ with an example describe linked list?

572


What are the defining traits of an object-oriented language?

668


Is map sorted c++?

496


What is runtime errors c++?

548


What is data structure in c++?

631


List the advantages of inheritance.

619


What is c++ programming language?

549


Where is atoi defined?

555


If dog is a friend of boy and boy is a friend of house, is dog a friend of house?

527


find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.

1973