[fpc-pascal] generics class hierarchy

David Emerson dle3ab at angelbase.com
Fri Dec 17 02:32:53 CET 2010


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;





More information about the fpc-pascal mailing list