Member-only story
Hi everyone, welcome back. Today, I will be covering the 4 principles that make up object-oriented programming. You may have heard of these terms, encapsulation, abstraction, inheritance, and polymorphism. These are the principles that make a language object-oriented. In this article, we will cover what each of one those mean and why it makes a programming language object-oriented.
Object-Oriented Programming
Before we dive into the principles, let’s go over some object-oriented basics first. An object is an entity of a class. A class can be thought as a blueprint in which object can be instantiated from. A class contains all the properties and actions an entity has or can do. These properties are stored as variables and the actions are saved as functions. The principles that we will go over heavily involve classes and objects.
Encapsulation
Encapsulation is when an object or functions of an object are hidden from other objects and classes. This allows objects to manage their own properties without having to worry about other classes. Encapsulation can be done with the use of access modifiers. Access modifiers, public, protected, and private, are used to determine the accessibility of variables and functions within a class. For instance…