OOPS CONCEPT IN ONE SHOT

Bhaskar Jha
2 min readMar 5, 2022

OOPS or Object-Oriented Programming is the style used in modern-day programming. It uses the concept of classes and objects; these are indeed helpful for polymorphism, inheritance, encapsulation, abstraction.

Features of OOPS:-

  • Abstraction is the property by virtue of which only the essential details are displayed to the user.
  • Inheritance allows you to create class hierarchies, where a base class gives its behavior and attributes to a derived class.
  • Polymorphism ensures that it will execute the proper method based on the calling object’s type.
  • Encapsulation allows you to control access to your object’s state while making it easier to maintain or change your implementation at a later date.

It gives the programmer power to create his custom datatypes and functions and use it to build programs that have different functions controlling different features of the program with restricted access to the sensitive data to the end-user.

Popular modern day languages like c++ , java , python ,c## etc. are examples of object oriented programming language.

CLASS

A class is a logical entity used to define a new data type. A class is a user-defined data type that describes what a particular kind of object will look like. Thus, a class is a template or blueprint for an object. A class contains variables, methods, and constructors.

Syntax to define a class:-

Example of a class:-

Now how this class will help us is it will allow us to define a structure/template for our objects and we need not to create a new object and define all the parameter again and again. Our objects will inherit all the properties of the class and we can modify the individual object later to.

eg:- In the Student class above age , roll_number properties are already created and a method display() that will show the age and roll_number when called .

OBJECT

An object is an instance of a Class. It is an identifiable entity with some characteristics and behavior. Objects are the basic units of object-oriented programming. It may be any real-world object like a person, chair, table, pen, animal, car, etc.

Example of creating objects:-

Code in object-oriented programming is organized around objects.

Once you have your objects, they can interact with each other to make something happen. You need to have a class before you can create an object. When a class is defined, no memory is allocated, but memory is allocated when it is instantiated i.e. when the object is created.

--

--

Bhaskar Jha

Software Developer by profession, Finance Enthusiast, and Tech lover, Noob at E-sports. Everyone should watch anime and make 2 friends join you(MLM😂)