File tree Expand file tree Collapse file tree
pattern/src/com/premaseem Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,7 +39,9 @@ public static void main (String[] args) {
3939
4040 // Crisp, reusable, centralized code using factory
4141 IceCreamFactory iceCreamFactory = new IceCreamFactory ();
42- iceCreamFactory .createIceCream (iceCreamChoice );
42+
43+ // Virtual constructor ( takes care of configuration )
44+ iceCream = iceCreamFactory .createIceCream (iceCreamChoice );
4345
4446// Repeatative code to even print
4547// System.out.print("Ice cream of your choice is ");
@@ -54,5 +56,11 @@ public static void main (String[] args) {
5456 System .out .print ("Ice cream of your choice is " + iceCream .getIceCreamName ());
5557 System .out .println (iceCream );
5658
59+ System .out .println ("Lessons Learnt" );
60+ System .out .println ("Creation is easy and simplified with virtual constructor" );
61+ System .out .println ("Centralized code easy to maintain and extend" );
62+ System .out .println ("Loosely coupled code with interface" );
63+ System .out .println ("Polymorphism in full force" );
64+
5765 }
5866}
You can’t perform that action at this time.
0 commit comments