C++ Access Control Question:
Download Questions PDF

Can you please explain the difference between struct and class in terms of Access Modifier?

Answer:

Classes and structures are syntactically similar. In C++, the role of the structure was expanded, making it an nalternative way to specify a class. In C, the structures include data members, in C++ they are expanded to have function members as well. This makes structures in C++ and classes to be virtually same. The only difference between a C++ struct and a class is that, by default all the struct members are public while by default class members are private.

Download C++ Access Control Interview Questions And Answers PDF

Previous QuestionNext Question
Explain Structure in C++?Explain classes and structure?