# Object Oriented Programming : OOP is a method of
programming.The main purpose of object oriented programming is that it
simplify the design, coding by providing re-usability and readability
and also debugging of a program is easier.
-Using this it is easy to identify where to add functions and its related data and which function is used to modify data.
-Features of oops :-Using this it is easy to identify where to add functions and its related data and which function is used to modify data.
[1] Object :-Objects is real world entity that is identify by its unique name.Object consist properties(attributes) and behaviours(methods).
For example a car is a object that have properties like colour, brand name etc. and behaviours like it can move forward and backward.
[2] class : Class is template from which object is created that contains variables for storing data and methods to performing operations on these data.Class have collection of similar type objects.
[3] Inheritance : Process of accessing the behaviours of base class by its derived class. Main advantage of inheritance is re-usability of the code.
(i) Single Inheritance : When a single base class is inherited by a single derived class then the inheritance is called as single inheritance.
(ii) Multilevel Inheritance : A base class inherited by derived and this derived class also inherited by its derived class.
For example grandfather's behaviours inherited by father and father's behaviours inherited by son.
(iii) Hierarchical Inheritance : A base class is inherited by more than one derived class.
For example sparrow, peacock, parrot inherits behaviours of bird class.
(iv) Hybrid Inheritance : Combination of all type of inheritance.
(v) multiple Inheritance : If a derived class inherits properties of more than one base class.
For example duck can swim and also fly.
-Ruby does not support multiple inheritance because it produce a conflict. For example if both the base class have same name then this will produce a confusion.
-So in ruby we can achieve multiple inheritance using module. Module provides a mixin facility. In mixin we can create modules that contains method and we can include more than one modules into our class and we can call modules method using object of class.
[4] Abstraction : Abstraction is the process of hiding implementation and showing only functionality to user.
For example Remote is a interface between user and TV.Using this we can on/off TV but we don't how to circuit works inside remote.
[5]
Abstract class : Abstract class is class that has undefined "abstract"
methods, which are left for subclasses to define. Abstract method does
not have implementation.
For example each bike has a start methods but may be a different technique for different bike for start. Some bike starts by kick and some starts by pressing button.
So we can declare start method as a abstract method and we can implements it in derived class for new bike.
[6] Encapsulation : Encapsulation is a process of binding data and methods together.Encapsulation protect data from unwanted access or alteration by making it private.
Encapsulation = Abstraction + Data Hiding.
[7] Polymorphism : Different behaviours at different instances depend upon the data passed in the operation. Polymorphism increase code readability.
For example a software engineer performs many task such as sometimes he performs coding, sometimes he performs testing, sometimes he performs analysis. So software engineer is one but he is performing different task depending upon requirement.
There are two types of polymorphism.
(i) Compile time polymorphism : It is achieved by method overloading. In this, call to a overloaded method is decide at compile time.
(ii)Runtime Polymorphism : It is achieved by method overriding. In this, call to a method is decide at runtime.
For example each bike has a start methods but may be a different technique for different bike for start. Some bike starts by kick and some starts by pressing button.
So we can declare start method as a abstract method and we can implements it in derived class for new bike.
[6] Encapsulation : Encapsulation is a process of binding data and methods together.Encapsulation protect data from unwanted access or alteration by making it private.
Encapsulation = Abstraction + Data Hiding.
[7] Polymorphism : Different behaviours at different instances depend upon the data passed in the operation. Polymorphism increase code readability.
For example a software engineer performs many task such as sometimes he performs coding, sometimes he performs testing, sometimes he performs analysis. So software engineer is one but he is performing different task depending upon requirement.
There are two types of polymorphism.
(i) Compile time polymorphism : It is achieved by method overloading. In this, call to a overloaded method is decide at compile time.
(ii)Runtime Polymorphism : It is achieved by method overriding. In this, call to a method is decide at runtime.
Awesome blog. I never understood oops this way till i read this blog. Great work. Thanks :)
ReplyDeleteI am not able to find a difference in Hierarchical Inheritance & Multilevel Inheritance example.
ReplyDeleteIn Hierarchical Inheritance "For example sparrow, peacock, parrot inherits behaviours of bird class", so do they in Multilevel Inheritance. Please if you can explain.
@anil_singh, hi i'm from pakistan, you did a great job,these concepts in any oop book seems like useless but here you just clear all confusions.
ReplyDeletethanks and your blog is awesome
Amazing blog about the various informative information on the programming languages. Android Training in Bangalore
ReplyDeleteIt was really a nice article and i was really impressed by reading this Ruby on Rails Online Training Bangalore
ReplyDeleteNice post ! Thanks for sharing valuable information with us. Keep sharing..Ruby on Rails Online Course Hyderabad
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteExpected to form you a next to no word to thank you once more with respect to the decent recommendations you've contributed hereindustrial course in chennai
ReplyDeleteThanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.
ReplyDeleteData Science Training in Chennai
Robotic Process Automation Training in Chennai
Cloud Computing Training in Chennai
Data Warehousing Training in Chennai
Dev Ops Training in Chennai
And indeed, I’m just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I’ve had.
ReplyDeleteDotnet Training in Chennai |Best Dotnet Training course in Chennai
Android Training in Chennai |Best Android Training course in Chennai
CCNA Training in Chennai | Best CCNA Training course in Chennai
MCSE Training in Chennai |Best MCSE Training course in Chennai
Embedded Systems Training in Chennai |Best Embedded Systems Training course in Chennai
Matlab Training in Chennai | Best Matlab Training course in Chennai
C C++ Training in Chennai |Best C C++ Training course in Chennai
This is very great thinks. It was very comprehensive post and powerful concept. Thanks for your sharing with us. Keep it up..
ReplyDeleteOracle Training in Chennai | Oracle Training Institutes in Chennai
Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
ReplyDeleteBest PHP Training Institute in Chennai|PHP Course in chennai
Best .Net Training Institute in Chennai
Big Data Hadoop Training in Chennai
Linux Training in Chennai
Cloud Computing Training in Chennai