I'll give a little more detail...

Right now I have these non-generic types:

t_point = class
  f_left, f_top : longint;  // so named for descendents
  // several fields and methods to manage it as I need
  end;

t_box = class (t_point)
  f_width, f_height : longint;
  // more fields and methods to manage it as I need
  end;


They've been great.
Now I have need for a point and box that use real coordinates. The structure 
would be identical -- simply replacing "longint" with "single" -- which is why 
I thought generics would be perfect.

However, t_box inherits from t_point, and this appears to be a sticking point.

My code looks like this:


generic gt_point<_num> = class
  f_left, f_top : _num;
  // other fields, methods
  end;

generic gt_box<_t_point,_num> = class (_t_point)
  f_width, f_height : _num;
  // other fields, methods
  end;

t_real_point = specialize gt_point<single>;

t_real_box = specialize gt_box<t_real_point,single>;


Thanks all!
~David.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to