[fpc-pascal] generics class hierarchy

David Emerson dle3ab at angelbase.com
Fri Dec 17 03:30:45 CET 2010


err... my mistake. the error message was referring to a different problem, which 
I was blind to in my hurry. Sorry for all the messages. I'll shut up now. :)

On Thu 16 Dec 2010, David Emerson wrote:
> Well, I'm guessing generics aren't really ready to be fully used... I'm 
getting 
> an error "There is no method in an ancestor class to be overridden" where the 
> ancestor class was a specialized generic. Doesn't seem very promising for 
> actual use.
> 
> So I'm abandoning generics for now. Hopefully they'll become more usable in 
the 
> future!
> 
> Keep up the good work, guys
> 
> Cheers,
> David
> 
> 
> ...here's what I couldn't do:
> 
> generic gt_point<_num> = class
>   f_left, f_top : _num;
>   procedure set_lt (l, t : _num); virtual;
>   end;
> 
> procedure gt_point.set_lt (l, t : _num);
>   begin
>     f_left := l;
>     f_top := t;
>   end;
> 
> generic gt_box<_t_point,_num> = class (_t_point)   // FAILS :-(
>   f_width, f_height : _num;
>   end;
> 
> t_real_point = specialize gt_point<single>;
> 
> t_real_box = specialize gt_box<t_real_point,single>;
> 
> t_special_real_box = class (t_real_box)
>   procedure set_lt (l, t : single); override;  // FAILS :-(
>   end;
> 
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 






More information about the fpc-pascal mailing list