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

Bridged painting

For a demonstration of the bridge pattern, let's look at a simple hierarchy of shape objects. The project is called Bridge and you'll find it in the folder Bridge. The unit Shapes.Abstraction contains the following hierarchy of classes:

type  TShape = class  end;  TRectangle = class(TShape)  end;  TTriangle = class(TShape)  end;

For demonstration purposes, we want to implement support for two very different display types: a Graphical User Interface (GUI) and a console text mode (ASCII). If we don't use the bridge interface, we need to implement four more classes:

type  TGUIRectangle = class(TRectangle)  end;   TASCIIRectangle = class(TRectangle)  end;   TGUITriangle = class(TTriangle)  end;   TASCIITriangle = class(TTriangle)  end; 
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