Multiple inheritance
what is multiple inheritance ? what use of interface in multiple inheritance ?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Rajesh Pathakoti159 pointsPosted Jul 23, 2014, 5:16 AM EDT
In dotnet we have
1)Simple
2)Multi level
3)Heirarchical
4)Hybrid
but in dotnet we not having multiple inheritance means deriving a new class from several base classes.
To overcome this Interfaces are introduced.
Interface: An interface looks like a class, but has no implementation. The only thing it contains are declarations of events, indexers, methods and/or properties. The reason interfaces only provide declarations is because they are inherited by classes and structs, which must provide an implementation for each interface member declared
Interface interface1
{
method1();
}
Interface intrface2
{
method2();
}
public class Test:interface1,interface2
{
//logic
}
And so much other uses also there
Please accept answer if it helps to you :)