On Thu, 19 Apr 2012, Graeme Geldenhuys wrote:

On 19 April 2012 00:04, Alberto Narduzzi <[email protected]> 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.

Michael.

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to