What is Object Oriented Programming Concepts(OOPs)
OOPs is stands for Object Oriented Programming concepts. Object-Oriented Programming (OOP) uses a different set of programming languages than old procedural programming languages (C ,c++, Pascal, etc.). Everything in OOP is grouped as self sustainable “objects”. Hence, you gain re-usability by means of four main object-oriented programming concepts.
Everything in Object Oriented Programming placed together works as a self-contained object. An object is a combination of variable and function and data can perform a set of relevant activity.
OOPs Features :
- The software is split into a number of small units called objects. The data and functions are put together around these objects.
- The object is a runtime entities class.
- The data of the objects can be accessed only by the functions related to that object.
- The functions of one object can access the functions of another object.
Polymorphism means one thing in many form. Basically polymorphism is capability of one object to behave in multiple ways. there are two type of polimorphism called as method overloading and method overriding.
Static Polymorphism (Method Overloading or Early Binding or compile time) :
Static polymorphism means we will declare a method with same name and different parameter/signature because of this we will perform different tasks with same method name in the same class is called compile time polymorphism.
Dynamic polymorphism (Method Overriding or Late Binding or run time) :
runtime polymorphism means we will declare a method with same name and same parameter or signature in the different class is called runtime polymorphism.
One of the most important concepts in object-oriented programming is inheritance. Inheritance allows us to define a class in terms of another class, which makes it easier to create and maintain an application. This also provides an opportunity to reuse the code functionality and speeds up implementation time.
Super Class: The class whose features are inherited is known as super class(or a base class or a parent class).
Sub Class: The class that inherits the other class is known as subclass(or a derived class, extended class, or child class). The subclass can add its own fields and methods in addition to the superclass fields and methods.
Reusability: Inheritance supports the concept of “reusabilit“, i.e. when we want to create a new class and there is already a class that includes some of the code that we want, we can derive our new class from the existing class. By doing this, we are reusing the fields and methods of the existing class.
Abstraction is represent the essential feature without representing the background details. Abstraction focus on what the object does instead of how it does it.
Abstraction provides you a generalized view of your classes or objects by providing relevant information.
Abstraction is the process of hiding the working style of an object, and showing the information of an object in an understandable manner.
Encapsulation means hiding the internal details of an object, in other words how an object does something.Encapsulation prevents clients from seeing its inside view, where the behaviour of the abstraction is implemented.
Encapsulation is a technique used to protect the information in an object from another object. Hide the data for security such as making the variables private, and expose the property to access the private data that will be public.
Also Learn More Tutorial :