Delphi, virtual method interception

Jacob Carlborg doob at me.com
Tue Aug 16 01:39:45 PDT 2011


On 2011-08-16 01:48, bearophile wrote:
> In Delphi Prism there is the colon operator too:
> http://prismwiki.codegear.com/en/Colon_Operator
>
> A quote from another page:
>
> instead of using "." to access members and get a NullReferenceException if they are nil, use ":" and the call will be skipped for nil (and the result will be nil itself). For example:
>
> // only call dispose if the interface is implemented.
> IDisposable(SomeObject):Dispose;
> // access the 3rd parent of a control, where any level might be nil.
> x := Button:Parent:Parent:Parent;
>
> Bye,
> bearophile

That's a nice feature, several other languages has the same feature as well.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list