In Object Oriented Programing concept there are 3 types of inheritences.
1. Single Inheritence,
2. Multiple Inheritence
3. Multilevel Inheritence
Single Inheritence:
public class A
{
}
public class B:A
{
}
Multiple Inheritence:
public class A
{
}
public class B
{
}
public class C:A,B
{
}
Multilevel Inheritence:
public class A
{
}
public class B:A
{
}
public class C:B
{
}
In the above three types C# dont proved Multiple Inheritence. As there is conflict of multiple override metods in base classes (say A, B in above example)
As in Place C# give another feature called Interfaces
using interfaces you can achive multiple Inheritence feature.
Ex:
public interface AX
{
}
public interface AY
{
}
public class LM:AX,AY
{
}
Interface doest not contain any member definition, it contains only the signature.g
No comments:
Post a Comment