Alokir t1_ixege0v wrote
Think of a class as a concept in the real world, like Dog or Animal. A class contains all data definitions and functionality necessary to work with this concept.
The functionality that relates to these concepts are called methods. For example, a Dog can bark, walk and wiggle its tail.
If you want to talk about a specific Dog you use the Dog class as a blueprint and create a dog object. Each time this happens the constructor is called automatically, which is a special method that is meant to set the initial values for the newly created object.
A struct is a way to group data together, it's easier to handle than having many individual variables.
Viewing a single comment thread. View all comments