what is OOPs (Object oriented programing).

what is OOPs (Object oriented programing).

what is OOPs (Object oriented programing).

Simula is considered the first object-oriented programming language.and Smalltalk is considered the first truly object-oriented programming language.

Object-oriented programming (OOP) :- First thing I want to let you know that OOPs not an any programing language basically. it is an concept or you can say that it is an model that uses object rather than the function. OOPs focus on implementing real-world entities like inheritance, abstraction, polymorphism, etc in programming. we will discuss all these thing further in very simple language.

 

what is oops

img by francescolelli 

Before going further you should know about some terms like object, class.

Object:- OBJECT is an instance of a class. An object is nothing but a self-contained component which consists of methods and properties to make a particular type of data useful.
in simple word :- Anything which have state and behavior called object such as a pen, chair, table, computer, watch, etc.
eg: Dogs have state (name, color, breed, hungry) and behavior (barking, wagging tail).

 

Class :- In object-oriented programming, a class is a blueprint for creating objects
or
class is a template definition of the method’s and variable’s in a particular kind of object.

eg. of class with object in ‘JAVA

            public class DemoClass {                // DemoClass is an ‘class’

           int x = 5; public static void main(String[] args) {

           DemoClass demoObj = new DemoClass();                // demoObj is an ‘object’

           System.out.println(demoObj.x);

 } }

Characteristics of OOPs:-

Data abstraction:-
Data abstraction refers to the process of representing essential features without including background details
Real life eg.:- for driving the car only thing we should know how to handle, how to use brake, Accelerator etc. but we don’t need to know how the engine is working, which engine running in the car.

 

Data encapsulation:-
The wrapping of data and function into a single unit is called data encapsulation.
or
the bundling of data, along with the methods that operate on that data, into a single unit. this is one of the most imp Characteristics of OOPs .

 

Inheritance:-
1) Inheritance is the process by which one object can acquire and the use of properties of another (parent) object .

Real life eg. :- Mobile is an base class(parent class) and its derive class is Samsang and nokia. so all the properties of Mobile is by default is present in Samsang and Nokia.

Why Inheritance :- Basically inheritance provide the concept of code reusability means once you write the code and then you can use this code by just inheriting the
class. this concept save the alot of the programmer.

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 sub class(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. this is also an one of the most imp Characteristics of OOPs .

Types of Inheritance :-

Single Inheritance : In single level inheritance, subclasses inherit the features of one base class. the class A serves as a base class for the derived
class B.

Multilevel Inheritance : In Multilevel Inheritance, a derived class will be inheriting a super class and as well as the derived class also act as the base class to
other class.

Hierarchical Inheritance : In Hierarchical Inheritance, one class serves as a superclass (base class) for more than one sub class.

Multiple Inheritance : In Multiple inheritance ,one class can have more than one base class and inherit features from all parent classes.
Note:- C++ supports but Java does not support multiple inheritance with classes

Hybrid Inheritance(Through Interfaces) :when we bind more than one inheritance then it is called Hybrid Inheritance . Since this Types of Inheritance  c++  support’s but java doesn’t
support multiple inheritance with classes, but we can achieve hybrid inheritance only through Interfaces in java. these are five Types of Inheritance present in OOPs concepts.

 

Polymorphism :-
“Poly”:-Means ‘Many’
“Morphism”:- ‘Forms’
Polymorphism means ‘many forms’
or
We can define polymorphism as the ability which can take any forms. this is one of the most imp Characteristics of OOPs.
eg:- A boy name ‘Rohan’ which play various role:- 1) Act as an student in school.
2) Act as an son for parents
3) Act as an friend for Friends.

polymorphism is mainly divided into two types:
1)Compile time Polymorphism
2)Runtime Polymorphism.

After reading this article I hope now you have good understanding over what is OOPs , Characteristics of OOPs , Types of Inheritance, etc.

extras:-

what is java and best ways to learn java in 2020-2021

What are the Top 5 programming languages in 2020

2 thoughts on

what is OOPs (Object oriented programing).

Leave a Reply

Your email address will not be published. Required fields are marked *

Reading is essential for those who seek to rise above the ordinary.

Discover Abloggerdude

Welcome to Abloggerdude, an author oriented theme.
A place where words matter. Discover without further ado our countless community stories.

Build great relations

Explore all the content form Abloggerdude community network. Forums, Groups, Members, Posts, Social Wall and many more. You can never get tired of it!

Become a member

Get unlimited access to the best articles on Abloggerdude and support our  lovely authors.

© 2020, Abloggerdude
Skip to toolbar