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.
4 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Viky TripathiPosted Aug 14, 2014, 1:32 PM
VulpesPosted Aug 14, 2014, 10:16 AM
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):
Naresh Babu GopavaramPosted Aug 14, 2014, 7:16 AM
Ravi KumarPosted Aug 14, 2014, 5:56 AM
c2 obj2=new c2();