Hello,

I'm trying to transform a manually implemented type, with pseudo-method as 
funcs/procs, into an fpc "class" type; and facing numerous issue: namely 3 
whole pages of compiler errors ;-).
Are there somewhere more or less pedagogic examples of class code?

*self*
Do i need to explicitely name self as param? Is self actually a pointer? If 
yes, do I need to treat as such, or is this magically handled by the language? 
Eg self^.prop or self.prop?

*destructor*
Is a destructor required? What is it supposed to do? Deallocation? (but then 
self disappears in the middle of a method it is the target of...). Isn't it 
garbage collected when dereferenced?

*type mutual recursion*
One func method returns an object of another type (actualy a record, but I 
guess it does not make any difference). But this record object holds a pointer 
to an object of the first type... Similar issue with a param of another method. 
There was no issue in the non-class version of the same code, since 
pseudo-methods (and their params and return values) did not need to be 
pre-declared.
By the way: why do we need to pre-declare methods, since they are bound to 
their type anyway by their name prefixes? (I mean so-called "qualified names" 
of the form type.methodName).

Denis
________________________________

vit esse estrany ☣

spir.wikidot.com
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to