docs: abstract-factory - readme - corrected code description as per real file (#1887)

This commit is contained in:
Fiordy 2021-10-24 08:49:52 +02:00 committed by GitHub
parent 1eb74203fc
commit c51eb66c89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,24 +87,36 @@ public interface KingdomFactory {
} }
public class ElfKingdomFactory implements KingdomFactory { public class ElfKingdomFactory implements KingdomFactory {
@Override
public Castle createCastle() { public Castle createCastle() {
return new ElfCastle(); return new ElfCastle();
} }
@Override
public King createKing() { public King createKing() {
return new ElfKing(); return new ElfKing();
} }
@Override
public Army createArmy() { public Army createArmy() {
return new ElfArmy(); return new ElfArmy();
} }
} }
public class OrcKingdomFactory implements KingdomFactory { public class OrcKingdomFactory implements KingdomFactory {
@Override
public Castle createCastle() { public Castle createCastle() {
return new OrcCastle(); return new OrcCastle();
} }
@Override
public King createKing() { public King createKing() {
return new OrcKing(); return new OrcKing();
} }
@Override
public Army createArmy() { public Army createArmy() {
return new OrcArmy(); return new OrcArmy();
} }