so i saw this example from stackoverflow to implement multiple inheritance by using interfaces.
interface ILARGESimulator
{
}
interface IUDPClient
{
}
class UDPClient : IUDPClient
{
}
class LargeSimulator : ILARGESimulator
{
}
class RemoteLargeSimulatorClient : IUDPClient, ILargeSimulator
{
private IUDPClient client = new UDPClient();
private ILARGESimulator simulator = new LARGESimulator();
}
The guy said "Unfortunately you will need to write wrapper methods to the members. Multiple inheritance in C# does not exist. You can however implement multiple interfaces."
Why do we inherit from both interfaces anyway?
class RemoteLargeSimulatorClient : IUDPClient, ILargeSimulator
If you are having a has-a relationship and calling the base objects on the derived class, why do even have to write :IUDP, ILargeSimulator
?
wouldn't it be simply
class RemoteLargeSimulatorClient
{
is good?