提交 5aead88e 编写于 作者: I Ilkka Seppala

Added comments for Abstract Factory example.

上级 601bd6bb
package com.iluwatar; package com.iluwatar;
/**
*
* The essence of the Abstract Factory pattern is a factory interface (KingdomFactory)
* and its implementations (ElfKingdomFactory, OrcKingdomFactory).
*
* The example uses both concrete implementations to create a king, a castle and an
* army.
*
*/
public class App public class App
{ {
public static void main( String[] args ) public static void main( String[] args )
......
package com.iluwatar; package com.iluwatar;
/**
*
* Concrete factory.
*
*/
public class ElfKingdomFactory implements KingdomFactory { public class ElfKingdomFactory implements KingdomFactory {
public Castle createCastle() { public Castle createCastle() {
......
package com.iluwatar; package com.iluwatar;
/**
*
* The factory interface.
*
*/
public interface KingdomFactory { public interface KingdomFactory {
Castle createCastle(); Castle createCastle();
......
package com.iluwatar; package com.iluwatar;
/**
*
* Concrete factory.
*
*/
public class OrcKingdomFactory implements KingdomFactory { public class OrcKingdomFactory implements KingdomFactory {
public Castle createCastle() { public Castle createCastle() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册