It eschews inheritance entirely, making ColorPoint own a reference to an instance of point rather than become a type of point.
它完全避开了继承,使ColorPoint拥有一个对Point实例的引用,而不是变成一种耦合点。
In his example, Bloch creates two classes - a Point and a ColorPoint - and tries to create an equals method that works correctly for both.
在此示例中,Bloch创建了两个类:Point和ColorPoint,并试图创建一个equals方法来适用于这两个类。
应用推荐