What is OOPs concept?
Before starting OOPs concept, I want to share History of OOPs . The OOPs concept comes in 1976 after that OOPs Language developed and it is written by Bjarne Stroustrup. In 1979, he developed oops language that is c++.
Simula is considered as the first object-oriented programming language.The programming paradigm where everything is represented as an object, so it is known as pure object-oriented language.
Lets Talk About OOPs (Object Oriented Programming System)
In this world everything is represented as object. Or every real entity is object. for example pen, pencil, Book, computer ,chair,table etc.
Before starting OOPs concept, I want to share History of OOPs . The OOPs concept comes in 1976 after that OOPs Language developed and it is written by Bjarne Stroustrup. In 1979, he developed oops language that is c++.
Simula is considered as the first object-oriented programming language.The programming paradigm where everything is represented as an object, so it is known as pure object-oriented language.
Lets Talk About OOPs (Object Oriented Programming System)
In this world everything is represented as object. Or every real entity is object. for example pen, pencil, Book, computer ,chair,table etc.
Every objects binded in any class like we all objects are part of Human. here this Human
is a class and we all are object of this class.
Object-Oriented Programming is a methodology to design a program using classes and objects. It simplifies the software development and maintenance by providing some concepts:
1. Object
2. Class
3. Encapsulation
4. Inheritance
5. Polymorphism
6. Abstraction
2. Class
3. Encapsulation
4. Inheritance
5. Polymorphism
6. Abstraction
Object:
Objects have states and behaviors. Example: We all have states like color, name, cast as well as behaviors like helping, smiling, eating.
An object is an instance of a class. It can be physical and logical.
Objects have states and behaviors. Example: We all have states like color, name, cast as well as behaviors like helping, smiling, eating.
An object is an instance of a class. It can be physical and logical.
Class:
Collection of objects is called class. It is a logical entity.OR we can say blueprint of objects is called class.
Collection of objects is called class. It is a logical entity.OR we can say blueprint of objects is called class.
Encapsulation:
Binding (or wrapping) code and data together into a single unit is known as encapsulation. For example: capsule, it is wrapped with different medicines.
A java class is the example of encapsulation. Java bean is the fully encapsulated class because all the data members are private here.
Binding (or wrapping) code and data together into a single unit is known as encapsulation. For example: capsule, it is wrapped with different medicines.
A java class is the example of encapsulation. Java bean is the fully encapsulated class because all the data members are private here.
Inheritance:
Its a parent-child relationship where child acquires all the properties and behaviours of his parent.
OR When one object acquires all the properties and behaviours of parent object i.e. known as inheritance.
It provides code re-usability.
Its a parent-child relationship where child acquires all the properties and behaviours of his parent.
OR When one object acquires all the properties and behaviours of parent object i.e. known as inheritance.
It provides code re-usability.
Polymorphism:
POLY means "many" and MOR means "forms" that means an object is able to show different output based upon the type of input.
lets take a example,
Suppose Water is an object and it has some different forms like solid, liquid and gas. At 0 degree Celsius it is solid, At normal temperature it is liquid and At 100 degree Celsius it is gas.
So here Water is a single object, but it has different different behaviour in different different situation..
theoretical, here Water is a polymorphic object and this phenomenon is termed as polymorphism.
POLY means "many" and MOR means "forms" that means an object is able to show different output based upon the type of input.
lets take a example,
Suppose Water is an object and it has some different forms like solid, liquid and gas. At 0 degree Celsius it is solid, At normal temperature it is liquid and At 100 degree Celsius it is gas.
So here Water is a single object, but it has different different behaviour in different different situation..
theoretical, here Water is a polymorphic object and this phenomenon is termed as polymorphism.
In java there are 2 types of polymorphism as follows:
1. Static Polymorphism:
When polymorphism is achieved at compile time, NOT yet runtime then it is termed as static polymorphism.
The method overloading is considered as an example of static polymorphism.
When polymorphism is achieved at compile time, NOT yet runtime then it is termed as static polymorphism.
The method overloading is considered as an example of static polymorphism.
2. Dynamic Polymorphism:
When polymorphism is achieved at run time then it is termed as dynamic polymorphism.
The method overriding is considered as an example of dynamic polymorphism.
When polymorphism is achieved at run time then it is termed as dynamic polymorphism.
The method overriding is considered as an example of dynamic polymorphism.
NOTE: we will learn more about polymorphism, type of polymorphism, compile time, run time, method overloading and method overriding in future. please leave this all topics here only. because here we r discussing only theory concepts. later we will discuss about programming or coding. how we will achieve that and all..
Abstraction:
The abstraction means that an object is visible in existence but not in reality then such object is termed as abstract object and phenomenon is termed as abstraction.
if you guys know little bit java, we will create a abstract method which have return type, method name but we will not written any statements in it. we will call it abstract method.
suppose i have one add() abstract method like
The abstraction means that an object is visible in existence but not in reality then such object is termed as abstract object and phenomenon is termed as abstraction.
if you guys know little bit java, we will create a abstract method which have return type, method name but we will not written any statements in it. we will call it abstract method.
suppose i have one add() abstract method like
abstract void add(int x, int y);
here in this above add method, i have not written any statements, now if you call this method. it will not perform any operation without writhing any statement inside the method how it will work. so its is called abstraction.
then question will be, what is the use of abstraction?
My answer will be: Hiding internal details and showing functionality is known as abstraction.
for example: if you guys want to call [phone call] someone you will dial his number and call him. or you guys will start thinking how my call go or flow in network or connect to all towers and all.. NO. right?
same, means you guys have functional info like how to call. u don't know internal details of it. how it will happen..
in simple words it is called abstraction.
My answer will be: Hiding internal details and showing functionality is known as abstraction.
for example: if you guys want to call [phone call] someone you will dial his number and call him. or you guys will start thinking how my call go or flow in network or connect to all towers and all.. NO. right?
same, means you guys have functional info like how to call. u don't know internal details of it. how it will happen..
in simple words it is called abstraction.
In java, we use abstract class and interface to achieve abstraction.
I Thinks now u guys know little bit theory about all OOPs concepts we discuss above. (Object, Class, Encapsulation, Inheritance, Polymorphism, Abstraction).
Don't worry guys.. this is all about theory, now from next tutorial we will discuss in details about all these topics. and we will learn how to use these all theory concept in programming[in Java.
Don't worry guys.. this is all about theory, now from next tutorial we will discuss in details about all these topics. and we will learn how to use these all theory concept in programming[in Java.
Free to ask ur doubts. don't go in programming, i already told first OOPs theory concepts came after that OOPs language came in market. so here we r learning only theory concept. from next tutorial we will start programming of it or we will start implementation of all OOPs concepts.
0 comments:
Post a Comment