Summary
You learned about objects in C++; they are pieces of code that tie data members and member functions together into a bundle of code called class
or struct
. Object-oriented programming means that your code will be filled with things instead of just int
, float
, and char
variables. You will have a variable that represents Barrel
, another variable that represents Player
, and so on, that is, a variable to represent every entity in your game. You will be able to reuse code by using inheritance; if you had to code implementations of Cat
and Dog
, you can code a common functionality in the base class Mammal
. We also discussed encapsulation and how it is easier and more efficient to program objects such that they maintain their own internal state.