Duck typing using RTTI
"When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck." | ||
--James Whitcomb Riley |
Clear, isn't it? What may not be so clear is that this approach can be used also in computer programming. Yes, even without an actual duck!
Getting started
Referring to Duck typing, Wikipedia gives the following explanation (http://en.wikipedia.org/wiki/Duck_typing):
In computer programming with object-oriented programming languages, duck typing is a style of typing in which an object's methods and properties determine the valid semantics, rather than its inheritance from a particular class or implementation of an explicit interface.
How can all these concepts be used in everyday programming? ...
Get Delphi Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.