Factory Method Design Pattern工厂方法模式
?? }
}
运行结果:
Motorola produced
Nokia produced
?
A?factory method can?be defined as a method in a class that:
(1)Selects an appropriate class from a class hierarchy based on the application context and other influencing factors
(2)Instantiates the selected class and returns it as an instance of the parent class type