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 the use of data hiding?

595


Evaluate as true or false: !(1 &&0 || !1) a) True b) False c) Invalid statement

633


What are enumerations?

655


How is new() different from malloc()?

630


What does namespace mean in c++?

550






What is class and structure in c++?

556


What is meant by the term name mangling in c++?

515


Why ctype h is used in c++?

523


How to tokenize a string in c++?

602


Write a program to add three numbers in C++ utilizing classes.

619


What is the history of c++?

557


Which function cannot be overloaded c++?

575


Why would you use pointers in c++?

623


Do vectors start at 0 c++?

533


How do we balance an AVL Tree in C++?

633