Classes or Structures (structs)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 15

Classes or Structures (structs)?

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

19th Dec 2016, 12:55 PM
Hatsy Rei
Hatsy Rei - avatar
3 Answers
+ 13
by default members in structure r public and in class r private. rest same
19th Dec 2016, 1:03 PM
manish rawat
manish rawat - avatar
+ 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.
9th Feb 2017, 10:05 AM
István Ács
- 3
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.
6th Feb 2017, 4:54 PM
MARRI ESWAR REDDY
MARRI ESWAR REDDY - avatar