Classes or Structures (structs)? | Sololearn: Learn to code for FREE!


Classes or Structures (structs)?

To query the difference(s) between classes and structures (structs)

12/19/2016 12:55:55 PM

Hatsy Rei

3 Answers

New Answer


by default members in structure r public and in class r private. rest same


Classes and structures in C++ are essentialy the same expect from their default access levels which is private for classes and public for structs. In every other way I know of they have the same functionality.


In structure we can't use the access specifiers whereas in class we can. In a class we can also declare a function but in structure we can't. While declaration of variables of a struct we must specify it's a structure by using keyword struct whereas in class it is not necessary.