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 MathewsRank #225 · 11K reputationPosted May 4, 2010, 11:48 PM EDT
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() { }
}
Sagar Kumar8 reputationPosted May 4, 2010, 11:40 PM EDT
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.
manas7 reputationPosted May 4, 2010, 11:47 PM EDT
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().
manas7 reputationPosted May 4, 2010, 11:54 PM EDT
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?
Jaish MathewsRank #225 · 11K reputationPosted May 5, 2010, 12:26 AM EDT
manas7 reputationPosted May 5, 2010, 12:47 AM EDT
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 MathewsRank #225 · 11K reputationPosted May 5, 2010, 1:34 AM EDT
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();
}