Hello Friends
I am Kushal Bhatt.
And I am here with new topic on object oriented concepts on our blog CompuTech.
So let's start our today's topic,
Object oriented concepts are relates to our life
Oops concept are used in real time use .
It is also provide data hiding so data can not accessible by external functions. data abstraction concept that help in improve the security.
In Object Oriented Programming program are divide in no. of objects.
New data and methods can easily add whenever necessary.
Object oriented programming is follow bottom to up in program design.
There are following concepts are providing by Object Oriented Programming.
1.class
2.Objects
3.Data Abstraction
4.Encapsulation
5.Inheritance
6.Polymorphism.
7.Message Communication
8.Data Binding.
1. Class:-
Class is a a way to enclose a methods variables in single package or unit known class.
So we can easily identify the behaviour of any variable and methods.
We can access this methods and variable by creating Object of class according use require so we can say that class provide blueprint of creating objects..
All data in class is private that means it is not accessible outside class in java that is called Abstract Data Type.
we will discuss a class declaration and structure in next blog post.
2. Objects:-
Object is basic run time entities.
normally Object is represent real life entities.
We can create any number of Objects of class.
by using this Object we can access the property of class.
object can interact without having to know the details of each others data or code.
there are different way tocreate object in different programming languages.
this object of class can interact to each other to share a information.
3. Data Abstracțion:-
Abstracțion is representing the essential features without including background details.that can help to represent Complex process or things in simple way.
Class is use this concept to defined list of attributes which is hold important information.
It is provide a security that unauthorized methods can not access data in class.
Take a example of Abstracțion,
We are withdraw cash from ATM we only perform certain steps but we not need to install cash in ATM we not need to worries to inform a bank Transactions. It is automatically handled.
Another example related java is once you write java source code and compile it and generate byte code by JVM but we not need to write a single line in JVM to perform this process we only compile it and generate a class file in seconds or minutes.
We can achieve a Abstracțion by implement interface or extend abstract class.
4. Encapsulation:-
Encapsulation is a process of bind or wrap variables and methods in single unit called Encapsulation.
This insulation is used to hide a data or methods from external access.objects and methos of that class can only access.
It is most strictly feature of class.
In every program encapsulation is used by class.
With help of encapsulation we have advantage like reusability data hiding and
Fast test in unit testing.
So it is provide security and maintaiblity of programs.
5.inheritance:-
Inheritance is mechanism to derive new class from old class is called inheritance or derivation.
Inheritance is provide concept of Reusablity.
that means we can add new features to existing class without modifing whole program.the new class has features of both classes.
old class called a base class. and derived class called to new class.
so new class need to defined only new features to it.
so it reduce length of code/
There are following types of Inheritance.
there are another type is multiple Inheritance but this is not supported by java it is supported by C and C++ .
in java Multiple Inheritance not support because it can make Program more Complex.
but in java there is replaced by Interface.
we will learn about in in deeply in another blog.
Inheritance is provide concept of Reusablity.
that means we can add new features to existing class without modifing whole program.the new class has features of both classes.
old class called a base class. and derived class called to new class.
so new class need to defined only new features to it.
so it reduce length of code/
There are following types of Inheritance.
1. Single Inheritance.
2.Multilevel Inheritance.
3. hierarchical Inheritance.
4. hybrid Inheritence.
there are another type is multiple Inheritance but this is not supported by java it is supported by C and C++ .
in java Multiple Inheritance not support because it can make Program more Complex.
but in java there is replaced by Interface.
we will learn about in in deeply in another blog.
6.Polymorphism:-
Polymorphism is Greek word that mean Ability to take more than one form.
This operation provide different behaviors in different situations.
This behaviors are depend upon data used in operations.
It is also known as Overloading.
Overloading has two types
1. Compile Time.
2. Runtime.
Example of polymorphism:-
Consider Operation of addition,
For two numbers operator generate sum.
Ex:-. 2+2=4.
For two strings operator perform concatenation
Ex:- "Kushal"+" Bhatt"=Kushal Bhatt.
In java,
Consider above figure,
Game_player is main class that inherits in three sub class
1.play_football
2.play_cricket
3.play_tennis.
All class are used same method game().
But print different things.
1.play Football
2.play Cricket.
3.play Tennis.
Note:We are not going to use program for this example because we not complete that chapter about java program structures related topic if we complete that the. I'll give internal link for program example for polymorphism.
7.Message Passing:-
Message passing is a process to interaction between objects of class.
Object are communicating with one other by sending and receiving the information.
Application has many objects to each other..
There are different way to message communication
1.using methods
2.using constructors
3.using objects.
4.using threads.
This all way we are use in practically which we will discuss in different blog post.
8.Data Binding:-
To process of connect to methods to call methods body is calling binding.
There are two way for binding data:-
1. Compile Time or static or Earlier Binding.
2. Runtime or Dynamic or Late Binding.
Compile Time Binding. is code which associated with given procedure at the Cimple Time is called Satic Binding or Compile Time Binding or Earlier Binding.
it is better then runtime binding performance wise .
all final,static,private methods is done at Compile Time.
Run time Binding is code that associated with given procedure at the runtime is called Runtime Binding or Dynamic Binding or Late Binding.
in runtime we can call a overidding method is example of runtime binding.
So this is brief description of object oriented programming hope it helpful to you .please share comment and like this post which is encourage me .
Thank you.
See you to next blog post.
I will also make blog on individual concepts of OOPs .
So this is brief description of object oriented programming hope it helpful to you .please share comment and like this post which is encourage me .
Thank you.
See you to next blog post.
I will also make blog on individual concepts of OOPs .
Comments
Post a Comment