Differentiate a structure and class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Differentiate a structure and class

6th Nov 2016, 6:06 PM
gowtham
gowtham - avatar
3 Answers
+ 2
Yes, that's it. Structurs originate from C, where you don't have classes and they wanted to keep everything C had. Classes are there because C++ is oop language.
6th Nov 2016, 6:19 PM
Milica Todorovic
Milica Todorovic - avatar
+ 1
The difference is: 1. Members of class are by the default set to private, and in structure they're set to public. Private means you may only access the members from the inside of the class, while with public you may do it from everywhere. 2. Classes have methods, while for structures you use functions.
6th Nov 2016, 6:09 PM
Milica Todorovic
Milica Todorovic - avatar
+ 1
that's it?..or still more..
6th Nov 2016, 6:11 PM
gowtham
gowtham - avatar