[fpc-pascal] Classes and class methods

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Wed Feb 9 14:42:31 CET 2011


Jonas Maebe wrote:
> On 09 Feb 2011, at 13:41, Mark Morgan Lloyd wrote:
> 
>> I'm doing something wrong- it works.
>>
>> I've got a sequence of classes, each with a Parent class procedure and 
>> Children() class function which reference a global array associated 
>> with each class (hardcoded name). Each class also has an Oid() 
>> function which appends a hardcoded number to whatever it's inherited.
> 
> A "class reference", which is the official name of a "class of xxx" 
> type, is basically a fancy monicker for the VMT of a class. So it's 
> normal that calling virtual class methods via class references works as 
> you'd expect.

It was the "class of" bit that I was initially missing- and I think I 
used the term "reference" in my initial question because I was gradually 
getting my head around the various issues.

In actual fact I was looking at the Forward type declarations section in 
the Reference guide yesterday and trying to work out exactly what "only 
possible with pointer types and classes" meant- pointers are adequately 
covered but I wonder whether an example of the latter form would be 
appropriate, even though it precedes the chapter on classes?

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list