OOPS concepts

What is Object Oriented Programming

Object-oriented programming structure (OOPS) is a programming paradigm based on the concept of “objects”, which may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods.


  • A class is an entity that helps the programmer to define a new complex data type.
  • A class is a blueprint or template or set of instructions to build a specific type of object.
  • Objects are the variables of type class.
  • A class defines the data and behaviour of objects.
  • In simple words, A class is a collection of objects of similar type.
  • Using a class , multiple objects can be defined.
  • E.g. mango, apple and orange are objects of Fruit class.


  • Objects are the basic run-time entities in object-oriented system.
  • An object is an entity that has state, behaviour and identity .
  • E.g. A computer mouse, is an object. It is considered an object with state and behaviour. Its states would be its colour, size and brand name. Its behaviour would be left-click, right-click and scroll.


  • Inheritance is a process by which objects on a new class(subclass)acquire the properties of objects of existing (superclass) class. It is in hierarchical order.
  • The concept of Inheritance provides the idea of re-usability. This means that we can add additional features to an existing class without modifying it.

Data Abstractions

  • Data Abstractions refers to the act of re-presenting essential features without including the back-ground details.
  • It is concerned with separating the behaviour of a data object from its re-presentation.
  • For example a car in itself is a well-defined object, which is composed of several other smaller objects like a gearing system, steering mechanism, engine, which are again have their own subsystems.


  • The process of binding data members and functions in a class is known as encapsulation.
  • Encapsulation is the powerful feature of object-oriented programming, with the help of this concept, data is not accessible to the outside world and only those functions which are declared in the class can access it.

Encapsulation Vs Abstractions

  • Encapsulation means that the internal representation of an object is generally hidden from view outside of the object’s definition.
  • Abstraction is a mechanism which represent the essential features without including implementation details.

Abstraction:Implementation hiding.

Encapsulation:Information hiding.


  • Polymorphism describes a pattern in object-oriented programming in which classes have different functionality while sharing a common interface (or a parent class).
  • So polymorphism is the ability (in programming) to present the same interface for differing underlying forms (data types).for example, Shape is an interface, it has Square, Circle, Diamond subtypes.

Method Overloading (Compile-time Polymorphism)

Overloading is ability of one function to perform different tasks, i.e,it allows creating several methods with the same name which differ from each other in the type of the input of the function.

Overloading can be used with functions and members.

Note: It’s not supported in PHP

Logically overloading should be like

But in PHP, this type overloading is not supported due to feature of optional parameters and loose type casting.

But in PHP overloading can be achieved through another way like

Method Overriding (Run-time Polymorphism)

  • Method overriding, in object-oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its super-classes or parent classes.


Check out our blog Formula to calculate developer’s salary in India.

Please follow and like us: