#590 Kramdown fixes

This commit is contained in:
Ilkka Seppälä
2017-08-12 21:44:21 +03:00
parent 2d750dc0fd
commit fba30e59ee
2 changed files with 11 additions and 1 deletions

View File

@ -20,14 +20,16 @@ decide which class to instantiate. Factory Method lets a class defer
instantiation to subclasses.
## Explanation
Real world example
> Blacksmith manufactures weapons. Elves require Elvish weapons and orcs require Orcish weapons. Depending on the customer at hand the right type of blacksmith is summoned.
In plain words
> It provides a way to delegate the instantiation logic to child classes.
Wikipedia says
> In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.
**Programmatic Example**
@ -53,6 +55,7 @@ public class OrcBlacksmith implements Blacksmith {
```
Now as the customers come the correct type of blacksmith is summoned and requested weapons are manufactured
```
Blacksmith blacksmith = new ElfBlacksmith();
blacksmith.manufactureWeapon(WeaponType.SPEAR);