22.1. Classes, objects and constructors

In object-oriented programming (OOP) we use a special kind of data structure called a class. A class is quite similar to an ordinary C struct. Particular instances of some class type are called objects. As well as having members which are data fields, a class also has members that are functions. If SomeClass were the name of a class and SomeFunction(…) happened to be the name of one of the class’s member functions, then it would make sense to have two lines like:

SomeClass K; 
K.SomeFunction(…); 

The first line says that K is an object of the class type SomeClass. You can also say that ‘K is a SomeClass object’ or you can say ‘K is an instance of the SomeClass class.’ Supposing K has a bunch of data fields, ...

Get Software Engineering and Computer Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.