[Lazarus] TImage - Getting image properties in 'canvas space'

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Thu Apr 19 10:32:01 CEST 2012



On Thu, 19 Apr 2012, Martin Schreiber wrote:

> On Thursday 19 April 2012 09:52:30 michael.vancanneyt at wisa.be wrote:
>> On Thu, 19 Apr 2012, Graeme Geldenhuys wrote:
>>> On 19 April 2012 00:04, Alberto Narduzzi <albertonarduzzi at yahoo.com>
> wrote:
>>>> An interface to a class (or its concept, anyway) is there for a reason.
>>>> And you should adhere to. I may also say that if you need to access a
>>>> protected, or private for what is worth, member of a (library...) class,
>>>> then you should revise your code... because either you're using the
>>>> wrong class, or your problem can be solved in a different, possibly more
>>>> elegant, and surely more OO compliant way ;-)
>>>
>>> I totally disagree...  :)
>>> type
>>>  // Friend class to get access to protected methods
>>>  THackCustomEdit = class(TCustomEdit);
>>
>> The Hack says it all. Here you are working outside regular OOP rules.
>>
>> The correct way would have been an implementation for each descendent of
>> TCustomEdit.
>>
>> You just took a shortcut. Nothing wrong with that by itself, but basing an
>> argument about general OOP rules on a shortcut implementation is incorrect
>> reasoning.
>>
>> In a system with stricter rules, you would have had to solve it
>> differently.
>>
> May I repeat the idea of "friend units"?

You can already use class helpers.

Michael.




More information about the Lazarus mailing list