正如我们已经看到的一样,Foo . say的修改是通过FooMaker类工厂在运行时严格确定的。
As already observed, the modification of Foo.say is determined strictly at runtime, via the use of the FooMaker class factory.
这与调用基类的工厂方法并断言返回对象具有正确类型一样简单。
This can be as simple as invoking the base class's factory method and asserting that the returned object is of the correct type. For example.
应用推荐