DHTMLAsp.NetSQLC-SharpXMLFrameworkIISXMLWebServiceArchitecture
UMLProject ManagementSDLCMethodologiesDesign PatterenOOPWCF.Net RemotingWWF
MVPMVCSite Map
Asp.net 2.0
User Control
Custom Control
File Handling
Reflection
Deligate
Site Map
Tell a Friend
You
Friend
Email

Newsletter
Email

Four core concept of OOP Object Oriented Programming. 1.Inheritance, 2.Polymorphism, 3.Abstraction and 4.Encapsulation


Encapsulation : Encapsulation is process of keeping data and methods together inside objects.
Encapsulation Sample
namespace Arindam
{
public class EtgEncapsulation
{
protected int _height;
protected int _width;
private int _thickness;
public EtgEncapsulation(int thickness)
{
this._thickness = thickness;
}
public int GetVolume()
{
int volume = this._height * this._width * this._thickness;
if (volume < 0)
return 0;
return volume;
}
}
}

Polymorphism : In simple word Polymorphism is the process of multiple implementation of single defination. let's look at the code below
Polymorphism Sample
namespace Arindam
{
public class EtgDeclaration
{
public virtual void Country()
{
Console.WriteLine("Here is my country name");
}
}
public class EtgPolymorphism : EtgDeclaration
{
public override void Out()
{
Console.WriteLine("India, A great country");
}
}
}

Inheritance : Inheritance is the process of creation new classes from already existing classes. The inheritance feature that allows us to reuse some parts of code of base class.
Inheritance Sample
namespace Arindam
{
public class Country
{
public string Name;
public double Temperature;
}
/* here i can use the all public members of base class.*/
public class India : Country
{
void ShowInfo()
{
this.Name = "India";
this.Temperature = 25.3;
}
}
}

Abstraction : "Abstraction" refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction and are defined as a list of abstract attributes.
Abstraction Sample
namespace Arindam
{
public abstract class MyAbstraction
{
public abstract string GetName { get; set; }
}
}
Privacy Policy ©2007 E-Tigers.net, All Rights Reserved Terms & Conditions
Supported by ETG Consultancy