Basic Concepts of Object-Oriented Programming (OOP)
Some of the features widely used in object-based programming include:
- Objects
- Classes
- Data abstraction and encapsulation
- Inheritance
- Polymorphism
- Dynamic binding
- Message passing
Objects:
Generally, the object can be represented as a real entity that has an identity and owns properties and behavior.
For example, an electric bulb is made by some company (identity) and it has some shape and wattage (properties) and gives light (behavior).
Technically, objects are the basic building blocks of an object-oriented system. They may represent a person, a place, a bank account, a data table, or any item that the program has to manage. The problem is analyzed in terms of objects and the nature of communication between them.
While the program is running, objects interact by sending messages to one another. For example, if “customer” and “account” are two objects in a program, then the customer object can send a message to the account object requesting the bank balance.
Each object will have data structures known as attributes and behavior or operations that manipulate the data.Each object will have data structures known as attributes and behaviour or operations that manipulate the data.

Object uniting both the data and operations
Classes:
The data and operations of an object put together with the help of a class make them a user-defined data type. In another sense, the objects are the variables of the class.
Once the class is defined, we can create any number of objects in this class. So, a class is a collection of objects of a similar type.
Example: In the class Person all the objects have similar data like name, age, gender, and operations like Speak, Listen, and walk. Thus boy and girl objects are grouped together, in-person class.
Class Person
Data: Name, Age, Gender
Operations: Speak( ), Listen( ), Walk( )
Person boy, girl; //objects of class Person
Data Abstraction and Encapsulation:
Integrating data and functions into one unit (called a class) is called encapsulation. Encapsulating the data is the most prominent feature of the class. The data is not accessible to the outside world, and only the operations or functions which are wrapped in the class can access it. This gives the interface between the object data and the program. This isolation of data from direct access by the program is called data masking or information hiding.
Abstraction is the act of representing essential characteristics without including details or background explanations. Classes use the concept of abstraction and are defined as a list of abstract data such as Name, Age, Gender, and operations to operate on these attributes. The class encapsulates all the essential properties of the objects to be created. The attributes are known as data members and operations are known as member functions or methods. Since classes use the notion of data abstraction, they are known as Abstract Data Type (ADT).
Inheritance:
Inheritance is the process by which objects in a class acquire the properties of objects in a different class. It supports the concept of hierarchical classification. It allows the declaration and implementation of the class to be based on an existing class.
For example, If the class Child inherits all the features of class Parent, then the class Parent referred to as a base class(superclass) and the class child referred to as a derived class(subclass).
In OOP, the concept of inheritance gives the idea of reusability. This means that we can add extra features to an existing class without altering it. This is possible by deriving a new class from the existing one. The new class will have the combined features of both these classes.

Polymorphism:
Polymorphism is another important OOP concept. Polymorphism, a Greek term, means the ability to take more than one form. An operation can present different behaviors in different cases. The behavior depends on the types of data used at the time of the operation.
For instance, adding an operation may add two numbers but, the same operation when applied to two strings it concatenates.
The process of making an operator present different behavior in different cases is known as operator overloading. Similarly, a unique function name can also behave differently depending on the different number and argument types and context.
For instance, the Draw ( ) function may be used to draw a circle, or a line or triangle depending on where it is used. The process of using a single function to carry out various tasks is known as function overloading.

Dynamic binding:
Binding refers to the relationship between a procedural call and the code to be executed in response to the call. Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known prior to the time of the execution call. It is associated with polymorphism and inheritance.
Message passing:
In traditional programming languages, a function is called on a given (function-based communication), while in OO languages, a message is sent to an object (message-based communication).
In OO languages, programming involves the following steps.
- Create classes to define objects and their behavior,
- Create objects from class definitions, and
- Establish communication among objects.
Objects communicate with each other by sending and receiving information in the same manner that people communicate with each other. The concept of messaging facilitates discussion about building systems that directly model or simulate their real-world counterparts.
A message relating to an object is a command to execute a function. It invokes a function inthe receiving object that generates the desired result. This implies specifying the name of the object, the name of the function (message), and the information to be sent.