Need multiple inheritance functionality in C#. What am I doing wrong?

后端 未结 6 1892
野性不改
野性不改 2021-01-19 09:08
class UDPClient
{
}

class LargeSimulator
{
}

class RemoteLargeSimulatorClient : UDPClient, LargeSimulator
{
}

The saying goes, if you need multip

6条回答
  •  借酒劲吻你
    2021-01-19 09:19

    One possible substitute for multiple inheritance is mixins. Unfortunately C# doesn't have those either, but workarounds are possible. Most rely on the use of extension methods (as a previous answerer suggested). See the following links:

    http://mortslikeus.blogspot.com/2008/01/emulating-mixins-with-c.html http://www.zorched.net/2008/01/03/implementing-mixins-with-c-extension-methods/ http://colinmackay.co.uk/blog/2008/02/24/mixins-in-c-30/

提交回复
热议问题