[fpc-pascal] 2.1.1 new protected

memsom memsom at interalpha.co.uk
Mon Aug 14 14:18:34 CEST 2006


> No. It just means the classes are designed wrong.

Very true. There are a number of places in Delphi's VCL where this is
true... for D5 at least.

> If you need to access directly private class fields, I think there are
> serious design flaws in your code.

Class "crackers" only give access to protected members - well in Delphi at
any rate.

type
  TCrackControl = class(TControl);

var
  _label: TLabel;

...

  TCrackControl(_label).Text := 'I can do this now';

This is pointless as the Text and Caption of a label map to the same
internal data, but using this method it demonstrates access to internals.

As to why Borland made a distinction between Caption and Text properties..
another debate ;-)





More information about the fpc-pascal mailing list