Abiding by these principles means that no IAnimal implementation should have a copy of IAnimal members on its default interface (e.g. Cat.eat, vs IAnimal.eat), and that entirely removes your point #2: 重新(重新)实现所有方法,以使它们从子类中公开,即使不需要重写也是如此.关于第1点... 重新实现IAnimal接口的所有方法这是编译器的要求,而不是VBA的怪癖:无论是Java,C#还是VBA,您都不能说我正在实现接口"……而无需实现其成员.当然是Java& C#允许类继承,因此您的基类可以说我正在实现接口",实现所有成员,派生类将愉快地继承它们-但这就是继承,而不是 composition .That's a compiler requirement, and isn't a VBA quirk: be it in Java, C#, or VBA, you can't say "I'm implementing an interface" ...without implementing its members. Of course Java & C# allow for class inheritance, so your base class could say "I'm implementing an interface", implement all the members, and the derived classes would happily inherit them - but then, that's inheritance, not composition anymore. 这篇关于VBA组合,实现类似Java的继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 19:34