[fpc-pascal] Re: class inheritance and type incompatibility
Sven Barth
pascaldragon at googlemail.com
Thu Sep 26 14:05:37 CEST 2013
On 26.09.2013 08:46, Xiangrong Fang wrote:
> 2013/9/26 Xiangrong Fang <xrfang at gmail.com <mailto:xrfang at gmail.com>>
>
>
> Which output:
>
> TIntTree
> TIntTree.TTree$LongInt
>
>
> Forgot to ask, I understand that TTree$LongInt is the name the compiler
> gave to the generic class when it is specialized, but what is
> TIntTree.TTree$LongInt? What is the meaning of "Scoped" type (or type
> with "namespace"?)?
Your TIntTree is declared like this:
=== code begin ===
type
TIntTree = class(specialize TTree<Integer>)
end;
=== code end ===
What the compiler now does is when it encounters the specialization it
generates a new type definition of that type (globally in the current
module, so that it can be reused by e.g. other classes) and adds a local
symbol reference to that type. So for code it appears that the parent
type was declared as a nested type inside the child type.
Regards,
Sven
More information about the fpc-pascal
mailing list