Hi,
I am little confused , How to solve the following senario.
Let's say I have a class
ClassA{
X();
Y();
}
And classB{
Z();
}
Now i want to create a classC which have Method X(),Y() and Z();
But the limitation is i cant change anything of classA and classB
Can any one help me ?
Regrads
Manas
Jaish MathewsPosted May 5, 2010, 3:48 AM
public abstract class MyClasses
{
public virtual void X() { }
public virtual void Y() { }
public virtual void Z() { }
//Add any furtehr methods here.
}
public class ClassA : MyClasses
{
public override void X() { }
public override void Y() { }
}
public class classB : MyClasses
{
public override void Z() { }
}
public class classC : MyClasses
{
public override void X() { }
public override void Y() { }
public override void Z() { }
}
Jaish MathewsPosted May 5, 2010, 5:34 AM
Without providing correct infromation, we can't assume any thing. It's not possible to define a class like below without class keyword and methods c an't put like X();Y();. It's giving compile time error to me.
Class A{
X();
Y();
}
Class B{
Z();
}
manasPosted May 5, 2010, 4:47 AM
Class A{
X();
Y();
}
Class B{
Z();
}
This 2 classes i shouldn't modifye and i need to give a single class to my client
The structure is
Class C{
X();
Y();
Z();
}
can it is possible.
Jaish MathewsPosted May 5, 2010, 4:26 AM
manasPosted May 5, 2010, 3:54 AM
I already have 2 3rd party dlls with class A & B
and i want to impliment methods inside in in a single class or dll for my customer.
How do i do it?
manasPosted May 5, 2010, 3:47 AM
Class A and B are 3rd party DLLs.
I cant modifye those.
And my problem is i want to create a Dll for my customers which will have all the 3 methods.
X(),Y() and Z().
Sagar KumarPosted May 5, 2010, 3:40 AM
In C# multiple inheritance achived by Interfaces not by classes.
but if u want to override the base class method in child class u can use polymorphism or if u want to change the signature of baseclass method in derived class(same name methods) use new keyword in derived class(i thing Shadowing).
In both the cases it won't effect base class memders.