What is object-oriented programming ?
is a programming paradigm based on the concept of "objects", which can contain data and code: data in the form of fields
Many of the most widely used programming languages are multi-paradigm and object-oriented programming support, to a greater or lesser degree, usually in combination with imperative, procedural programming.
A characteristic of objects is that an object's own procedures can access and often modify the data fields of itself
Languages that support classes almost always support inheritance.
For example, the Employee class can inherit from the Person class. All data and methods available to the parent class also appear in the child class with the same names
This allows classes to be organized into a hierarchy representing "is a type of" relationships.
In OOP, computer programs are designed by making them from objects that interact with each other
Encapsulation is an object-oriented programming concept that ties together data and the functions that manipulate the data, and keeps it safe from external interference and misuse. Data encapsulation led to the important OOP concept of data cloaking.
If a class does not allow the calling code to access the internal data of the object and allows access only through methods, this is a strong form of abstraction or hiding of information known as encapsulation
Languages that support object-oriented programming (OOP) often use inheritance for reuse and extensibility of code in the form of classes or prototypes. Those who use classes support two main concepts
Classes: the data format definitions and procedures available for a given type or class of object; they can also contain data and procedures themselves
Objects sometimes correspond to things found in the real world. For example, a graphics program can have objects like "circle", "square", "menu". An online shopping system can have objects such as "shopping cart", "customer" and "product".
part
Class variables: they belong to the class as a whole; there is only one copy of each
Instance variables or attributes: data that belongs to individual objects; each object has its own copy of each
Member variables: Refers to both the class and the instance variables defined by a particular class.
Instance methods: They belong to individual objects and have access to the instance variables for the specific object being called, the inputs, and the class variables.
Class methods: they belong to the class as a whole and have access only to the class variables and the inputs of the procedure call