Let's imagine you're managing a small car dealership. You want to have a way of managing all of the cars you have in stock. This includes keeping track of their brand names, their horsepower, their license plate texts and their mileage. Currently, you have four different cars in stock, and you want your program to print out all of the information about all of the cars.
- The cars are represented by a
Car
class - The
Car
class contains several fields for the different types of information - The information can be printed out using a method in the
Car
class, similarly to how we did it for the tables.