Design pattern to use instead of multiple inheritance

后端 未结 8 2539
离开以前
离开以前 2020-12-09 03:16

Coming from a C++ background, Im used to multiple inheritance. I like the feeling of a shotgun squarely aimed at my foot. Nowadays, I work more in C# and Java, where you can

8条回答
  •  佛祖请我去吃肉
    2020-12-09 03:47

    abstract class Magical: CustomButtonUserControl
    {
        public void DoMagic()
        {
            // ...
        }
    }
    
    public class TypeA : Magical
    {
    
    }
    
    public class TypeB : Magical
    {
    
    }
    

提交回复
热议问题