Senario
Public Classs C1
{
public void Method1()
{
Console.WriteLine("Method1") ;
}
}
Public Classs C2
{
public void Method2()
{
Console.WriteLine("Method1") ;
}
}
Public Classs C3:C1,C2
{
Static Void Main()
{
C3 obj=new C3();
//here i want call Method1 and Method to
obj. Method1();
obj. Method2();
}
}
How can i achive the above thing with out using interfaces.


VulpesRank #55 · 29.2K reputationPosted Aug 14, 2014, 6:16 AM EDT
C3 can only inherit from (at most) one class.
The usual way around it is to use inheritance for one class but 'containment' for the other(s):
Ravi KumarRank #2,085 · 690 reputationPosted Aug 14, 2014, 1:56 AM EDT
c2 obj2=new c2();
Naresh Babu GopavaramRank #9,687 · 203 reputationPosted Aug 14, 2014, 3:16 AM EDT
Viky Tripathi33 reputationPosted Aug 14, 2014, 9:32 AM EDT