[fpc-pascal] Subclassing generic records?
    Ryan Joseph 
    ryan at thealchemistguild.com
       
    Mon Jul 17 17:53:42 CEST 2017
    
    
  
I’m trying to find a way to extend generic records since (as far as I know) there is no subclassing of records. I could use variant records here but these don’t work with generics so I tried record helpers and properties to basically rename the x/y variables in TVec2 but I get errors on the width/height properties. Is there a workaround for this?
type
	generic TVec2<T> = record
		public
			x, y: T;
	end;
type
	TSize = specialize TVec2<TFloat>;
type
	TVec2Size = record helper for TSize
		property Width: TFloat read x write x;
		property Height: TFloat read y write y;
	end;
Regards,
	Ryan Joseph
    
    
More information about the fpc-pascal
mailing list