By adding a wrapper class, you have broken subtype polymorphism.
通过添加包装程序类,您打破了子类型的多态性。
The traditional object-oriented solution to problems of this sort is to leverage subtype polymorphism - that is, inheritance.
针对这类问题的传统的面向对象的解决方案是利用子类型多态性—也就是说,继承。
Type polymorphism and polymorphism in object-oriented programming: Read Wikipedia's articles about polymorphism, including subtype polymorphism.
类型多态性和面向对象编程的多态性:阅读有关多态性的Wikipedia文章,包括子类型多态性。
应用推荐