Skip to Main Content
Mastering Delphi Programming: A Complete Reference Guide
book

Mastering Delphi Programming: A Complete Reference Guide

by Primož Gabrijelčič
November 2019
Beginner to intermediate content levelBeginner to intermediate
674 pages
15h
English
Packt Publishing
Content preview from Mastering Delphi Programming: A Complete Reference Guide

Factory method

The factory method pattern specifies how an object can defer creation of some internal data and leave the actual task of creation for the derived class. It is part of the original Gang of Four book.

Imagine a kid making cookies out of dough. They can do nothing until they invoke the factory method and say, Give me a cutter. So, you provide them with a cookie cutter (the result of the factory method), and they can finally start making cookies.

 

By implementing this approach, you can be flexible and select the appropriate cookie shape for the occasion. Output from the factory method therefore changes the final result.

The functionality of this pattern, as described in the original Design Patterns publication, looks very similar ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Delphi GUI Programming with FireMonkey

Delphi GUI Programming with FireMonkey

Andrea Magni
Delphi Cookbook - Third Edition

Delphi Cookbook - Third Edition

Daniele Spinetti, Daniele Teti

Publisher Resources

ISBN: 9781838989118Other