[fpc-pascal] class property accessor static

Maciej Izak hnb.code at gmail.com
Tue Feb 7 14:40:12 CET 2017


2017-02-07 14:35 GMT+01:00 Mattias Gaertner <nc-gaertnma at netcologne.de>:

> > 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...
>
> Class methods can be overridden.


not static. btw. class property is not my idea :P.

Don't forget that you can use property as array and is possible to use
index keyword.

type
  TFoo = class
    class function F(i: integer): byte; static;
    class property P1: byte index 10 read F;
    class property P2[idx: integer]: byte read F;
  end;

-- 
Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170207/616fcb19/attachment.html>


More information about the fpc-pascal mailing list