Answers

Question and Answer:

  Home  C++ Access Control

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

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.

 361 views

More Questions for you: