It is a type of programming in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure. In this way, the data structure becomes an object that includes both data and functions. In addition, programmers can create relationships between one object and another. For example, objects can inherit characteristics from other objects.
One of the principal advantages of object-oriented programming techniques over procedural programming techniques is that they enable programmers to create modules that do not need to be changed when a new type of object is added. A programmer can simply create a new object that inherits many of its features from existing objects. This makes object-oriented programs easier to modify.
Advantages of Object Oriented Programming
- Provides a clear and modular structure for programs.
- It implements real-life scenario.
- You can directly deals with operations applied for Data Structures.
- It is easy to maintain and modify existing code.
- Much suitable for large projects.
- Makes software development more easy and reliable.
- Procedural and Object Oriented Nature.
- Simplify Memory Management.
- Good for defining abstract data types.
Basic Concepts of Object Oriented Programming
Objects are the basic run-time entities in an object-oriented system. Objects are identified by its unique name. An object represents a particular instance of a class. There can be more than one instance of an object. Each instance of an object can hold its own relevant data. An Object is a collection of data members and associated member functions also known as methods.
Classes are data types based on which objects are created. Objects with similar properties and methods are grouped together to form a Class. Thus a Class represents a set of individual objects. Characteristics of an object are represented in a class as Properties. The actions that can be performed by objects become functions of the class and is referred to as Methods.
Abstraction refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction and are defined as a list of abstract attributes. Data Abstraction increases the power of programming language by creating user defined data types.
The wrapping up of data and functions into a single unit is known as Data Encapsulation. The data is not accessible to the outside world and only those functions which are wrapped in the class can access it. This insulation of data from direct access by another program is also called “Data Hiding” or “Information Hiding”.
It is the process by which one object acquires the properties of another object. This supports the hierarchical classification. Without the use of hierarchies, each object would need to define all its characteristics explicitly. However, by use of inheritance, an object need only define those qualities that make it unique within its class. It can inherit its general attributes from its parent. A new sub-class inherits all of the attributes of all of its ancestors. In Object Oriented Programming the concept of inheritance provides the idea of reusability. These means that we can add additional features to an existing class without modifying it. In Inheritance base class is also known as parent class or super class, the new class that is formed is called derived class. Derived class is also known as a child class or sub class.
Polymorphism means the ability to take more than one form. An operation may exhibit different behaviours in different instances. The behaviour depends on the data types used in the operation. Poly a Greek term ability to take more than one form. Overloading is one type of Polymorphism. It allows an object to have different meanings, depending on its context. When an existing operator or function begins to operate on new data type, or class, it is understood to be overloaded.
7. Message Passing
The process by which an object sends data to another object or asks the other object to invoke a method. Message passing corresponds to “Method Calling”.
8. Dynamic Binding
Binding refers to the linking of procedure call to the code to be executed in response to the call. Dynamic binding means that the code associated with the given procedure call is not known until the time of the call at run time. It contains a concept of Inheritance and Polymorphism.