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 kind of problems can be solved by a namespace?

840


What are the various compound assignment operators in c++?

760


What is the difference between global variables and local variable

768


What are vtable and vptr?

916


Is there any function that can skip certain number of characters present in the input stream?

827


What is const pointer and const reference?

871


Do you know the use of vtable?

899


What are c++ files?

926


What is an orthogonal base class in c++?

910


What is c++ try block?

843


What is an adaptor class or wrapper class in c++?

831


What is prototype in c++ with example?

776


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create

2347


Can you sort a set c++?

812


What are references in c++? What is a local reference?

806