Am 07.02.2017 14:31 schrieb "Graeme Geldenhuys" <
mailingli...@geldenhuys.co.uk>:
> I never understood Object Pascal's class methods/properties either?
> Unlike Java, not everything needs to be in a class. We are allowed to
> have procedures or functions, and global ones at that. So in Object
> Pascal we could simply have a unit called FooStuff where everything
> related to Foo is defined, then have a global function F() and then use
> it as follows...

It allows for grouping. This way one can directly see (by using the
completion window or by peeking at the declaration oneself) that there is a
routine F() that belongs somehow to TFoo. If you put that into a separate
unit however then it isn't clear by itself that the stuff relates to TFoo.
In the end it's a question of taste. I personally like class methods and
class properties.
Oh and don't forget that non-static class methods can be virtual (sometimes
I really miss that in C++).

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to