[fpc-pascal] Classes and class methods

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Thu Feb 10 14:46:36 CET 2011


Luiz Americo Pereira Camara wrote:
> On 9/2/2011 07:58, Mark Morgan Lloyd wrote:
>> Is it possible to put a class (not an instance) in a variable or array 
>> element, and to use this to call a class method?
>>
>> I'm defining a hierarchy of classes and it would be convenient if it 
>> were possible to register the fact that a class had a particular 
>> subclass, such that the information was available before instantiation.
>>
>> I'm assuming that the code that inspects the array has imported all 
>> units so is aware of the relevant class declarations, but I am still 
>> having problems with calling class methods and/or casting to a class 
>> (as distinct from an instance).
>>
> 
> Are you looking for something like this?: 
> http://code.google.com/p/luipack/source/browse/trunk/luicontrols/wizardcontrols.pas#266 

No, I'm doing something simpler- setting up a sequence of classes to 
mimic the definition of a node in an SNMP MIB file. I've got to the 
point where I can query (the Pascal transcription of) a MIB file to find 
out what nodes it implements and can work backwards and forwards to list 
the OIDs associated with a node and its ancestors-descendants- all 
without instantiating anything.

-- 
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