This article explains Object Oriented Programming (OOP).
What is an Object?
An object means what is real that is called an object. For example, a man having two legs, two hands and so on. That is called an object. Now what we said to this man?
It's called a class.
Class means it's a template or blueprint of an object.
For example you are a class and your legs and hands are called objects.
Why to use OOP
Before OOP we used Functional Oriented Programming. In Functional Programming there are problems, like it is difficult to reuse. When a new programmer comes to development, it becomes difficult for some of them to understand. That's why OOP concept was introduced. Using Object and Class we are thinking the real world things easily and it's easy to understand for developers.
There are the following 4 properties of OOP:
- Encapsulation
- Abstraction
- Inheritance
- Polymorphism
Encapsulation
Encapsulation means hiding the complex.
Example
We know the laptop will work, but a laptop doesn't show you how to run inside that.
Abstraction
Abstraction means show what is necessary.
Example
We want my laptop key to work properly and take my input into my system, but we don't want a CD drive.
Abstraction Implement Encapsulation and vice versa.
Inheritance
Inheritance inherit something from others. It's basically used for a parent-child relationship.
Example
Let's assume one father has two children, both of the children inherit some property from the parents property.
Polymorphism
Polymorphism means one form have multiple behavior in different situation.
Example
A persons behavior is as a lecture when he was in school and the same person's behavior is as a parent when he is in the front of his children.
Some points to remember:
- Polymorphism is used for decoupling.
- Polymorphism doesn't work without inheritance.
anupam dineshPosted Sep 14, 2017, 7:35 AM
Awesome article ....thanks for share
Javaid IqbalPosted May 4, 2017, 6:42 AM
Thanks for such excellent article
Pradeep SahooPosted Nov 8, 2016, 9:47 AM
Good Information, Thanks for sharing the article
Santhakumar MunuswamyPosted Jul 23, 2015, 3:00 PM
Thanks for nice article:)
Santhakumar MunuswamyPosted Jul 23, 2015, 3:00 PM
Welcome
Santhakumar MunuswamyPosted Jul 23, 2015, 3:00 PM
Good Start
Sam HobbsPosted Jul 21, 2015, 3:07 PM
Welcome to C# Corner.
Gopi ChandPosted Jul 21, 2015, 2:44 PM
Good start...welcome
Sibeesh VenuPosted Jul 21, 2015, 9:35 AM
Nice Share.