Start C# here

Study C#.. Go ahead ! !

Saturday, March 1, 2008

What is Object Oriented Programming?

So, Lets start from the First. Before we all start one must be aware of what is Object Oriented Programming? So do you know what is Object Oriented Programming?
Object Oriented Programming(OOP)


Object Oriented Programming was first introduced in 1960’s.The main reason behind this programming is to make the program user friendly. OOP concept is related to the real-world system (i.e concept of Classes and Objects).


What is a CLASS?
Class is just a Virtual concept of a collection of related items together which we cannot see or feel.In programming we create Classes to define collection of related variables and functions.
Class is a user defined Data Type


What is an Object?
In simple words -- Object is an Instance of a Class. We can access a Class only through its Objects.Without objects we cannot say a Class is existing.A thing which has the properties of a class is known as Objects.

For eg:- Car is a Class and Tata Indica is an Object of the class Car
Objects….


We generally identify object by its State, Behavior and Identity.
If we take a car Indica its state is its color, wheel, body, etc….

Its Behavior is moving, changing gears etc…
And the identity of the car is its Number lets say KL-7 AD 2544.

Here state and behavior may be same for many objects but the identity of object will not be same for other object.


Characteristics of OOProgramming…

The main characteristics of Object Oriented Programming are:-

  • Inheritance
  • Encapsulation
  • Abstraction
  • Polymorphism



INHERITANCE

The ability of a class (Derived Class) to derive or Inherit the properties of another class (Base Class) is called Inheritance.Inheritance helps in the reusability of code hence making the program smaller and easy to use.
Eg:- Parent child relationship. Child is Inherited from its parents


ENCAPSULATION


Process of Hiding the data from a user is called Encapsulation; also called Data Hiding.


ABSTRACTION


The process of showing essential features without giving any explanations is known as Abstraction.


POLYMORPHISM


The name Poly Morphism means Many Forms. It is the process by which we create same things with different behaviors.
Eg:- Function overloading…
Eg Same person behaving in different ways. Make the person you teach as the example and ask him whether he behaves like the same when he is in front of his Principal and friend…. You can change the principal to Police also so the student will really understand what is poly morphism.

No comments: