December 2015
Beginner to intermediate
195 pages
2h 52m
English
![]()
GoF Definition: Define an interface for creating an object, but let subclasses decide which class to instantiate. The factory method lets a class defer instantiation to subclasses.
The concept can be best described with the examples below.
Suppose you have two different types of televisions—one with an LED screen and another with an LCD screen. If any of these starts malfunctioning, you will call a TV repairman to request a visit to your residence. The repairman must ask first what kind of TV is nonoperational. As per your input, he’ll carry the required instruments with him.
Read now
Unlock full access