本章站在OOD的角度,将继承看成实现OOD的强大手段,通过具体例子,说明针对接口编程(Program To An Interface)、混入类(Mix In Class)、基于角色的设计(Role-based Design)这三个与继承紧密相关的著名OOD技巧。
基于1个网页-相关网页
Even if you program to an interface the implementation class still needs to be instantiated somewhere.
即使您按接口编程,仍然需要在某个地方实例化实现类。
The first principle is: "Program to an interface, not an implementation."
第一条是:“面向接口编程,而非面向实现编程”。
Program to an interface, not an implementation.
面向接口编程,而不要面向实现编程。
应用推荐