Understanding OOP
Before diving into the world of OOP, it is necessary to lay the groundwork by explaining some fundamental OOP concepts and terms. Following this, you will learn how to create C++ classes and utilize the new classes to instantiate objects, allowing for the practical implementation of OOP principles.
What is OOP?
In the MyCPP_0x
projects, we wrote functions to perform operations on the data. The approach we used is actually called procedural programming.
OOP is defined as a programming paradigm built on the concept of objects. OPP tries to reflect real-world concepts by creating objects that contain attributes (fields) and functions (methods).
There are three major pillars on which OOP relies:
- Encapsulation: This means that data and functions can be wrapped up into classes so that some sensitive data is hidden from users.
- Inheritance: This means that a class can derive from another base class to be its child class. The child class can inherit...