The theory of a Pong Bat
What follows is a hypothetical discussion of how we might use OOP to get started with the Pong project by coding a Bat class. Don't add any code to the project just yet as what follows is over-simplified in order to explain the theory. Later in this chapter, we will code it for real. When we get to coding the class for real, it will actually be quite different, but the principles we will learn about here will prepare us for success.
We will begin by exploring variables and functions as part of a class.
The class variable and function declarations
A bat that bounces a ball would be an excellent first candidate for a class.
Tip
If you don't know what Pong is, then take a look at this link: https://en.wikipedia.org/wiki/Pong.
Let's take a look at a hypothetical Bat.h
file:
class Bat { private: // Length of the pong bat ...