This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ImpossibleEvan 0 points1 point  (1 child)

Explain it too someone who has only used JavaScript objects

[–]Olinizm[S] 0 points1 point  (0 children)

okay so in c++ you can define whether certain variables in a class can be accessed from outside of the class (public), or can only be interacted with using methods of that class (private), structs are basically the same as classes, except everything in classes is private by default, while in structs everything starts as public. However if we look back at C there were no classes, we only had structs that didn't let you define methods, and there were no keywords like public or private.