[fpc-pascal] generics class hierarchy
dle3ab at angelbase.com
Sun Dec 19 02:51:13 CET 2010
Sven Barth wrote:
> I've now looked at your example code in more detail (I was working the
> last time I wrote you). Where did you define "_t_point"? I only found a
> "t_point" in your second mail.
_t_point is part of the template list.
I guess it's a limitation. Conceptually it doesn't seem that different to be
specifying a class to inherit from in the template list, but the compiler isn't
handling it yet.
> Would you please post (or at least attach) your complete test unit? In
> the meantime I'll try to test it with the code pieces you wrote.
generic gt_point <_num> = class
f_left, f_top : _num;
procedure set_lt (l, t : _num); virtual;
generic gt_box<_t_point,_num> = class (_t_point) // FAILS :-(
f_width, f_height : _num;
t_real_point = specialize gt_point<single>;
t_special_real_point = class (t_real_point)
procedure set_lt (l, t : single); override;
procedure gt_point.set_lt (l, t : _num);
f_left := l;
f_top := t;
procedure t_special_real_point.set_lt (l, t : single);
More information about the fpc-pascal