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

+14

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

+13

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

+5

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.

-2

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.