[fpc-pascal] "class" methods for objects
Michael Van Canneyt
michael at freepascal.org
Fri Jul 16 14:48:08 CEST 2010
On Fri, 16 Jul 2010, Helmut Hartl wrote:
> Am 16.07.10 12:46, schrieb Michael Van Canneyt:
>>> Always learning something new.
>>>
>> One is never too old to learn :-)
>>
>> Michael.
> But one is always able to age faster,
> while boldly going to where no man has gone
> baldly before :-) (spelling intentional)
>
> While testing with a simplified usage pattern I encountered a compiler
> problem.
> Should I report a bug - or am I missing something ?
>
> helmut
>
>
> --snip--
> program project_static2;
> {$static on}
> type
> Etyp=(t1,t2,t3);
>
> function ProxyObject_IsInSubrange(const typ:Etyp):boolean;
> begin
> ProxyObject_IsInSubrange:=typ<=t2;
> end;
> type
> ProxyObject=object
> function IsInSubrange(const typ:Etyp):boolean;static;
> end;
>
> RealObject=object
> mytyp:Etyp;
> function IsInSubrange:boolean;
> end;
>
> function RealObject.IsInSubrange: boolean;
> begin
> IsInSubrange:=ProxyObject.IsInSubrange(mytyp); // project1.lpr(25,15)
> Error: Class isn't a parent class of the current class
This could be a bug in the compiler, yes.
Michael.
More information about the fpc-pascal
mailing list