Thursday 10 October 2013

Object-oriented programming (OOP) concept

OOPS CONCEPT IN C#  :

It is a problem solving technique to develop software system.

Class :
1. It is  collection of data member and member function.
2. Class is reference type 
3. All the classes are by default derived from System.Object class.
4. Class allocate memory in managed heap.
5. It is designed for the inheritance.
6. we can create object of class by using new operator only.

Data types :

Value Type :   Structure,int,float etc.
Reference Type : Class,interface ,delegate,dynamic,object,string etc.

Dynamic,Object,String Built in reference type.

Difference between structure and class:

Structure : It is a collection of related data element in continuous memory location.

1. It is value type System.Value Type is base class of all the structures.
2. It is allocate memory in stack.
3. It is not designed for inheritance.
4. We can create object of structure without new as well as new operator

Encapsulation :
Taking the data and method as a single unit is called encapsulation.
A class an example for encapsulation.
Encapsulation is a protective mechanism.
Advantage :
we can use same names for the members of two different classes.

Abstraction :
Hiding unnecessary data from the users is called abstraction.
various levels of abstractions can be achieved using the keywords private ,public ,protected and default  these keywords are called access specifiers or access modifiers.

Inheritance :
Producing new classes from existing classes is called inheritance.
Re usability of code is an main advantage of inheritance.

Polymorphism :
The ability to exits in various forms is called polymorphism.
In polymorphism we have two different types :
1. Compile Time Polymorphism or Early Binding or Overloading or static binding.
2. Run Time Polymorphism or Late Binding or Overriding or Dynamic binding.

No comments:

Post a Comment