Create an extended type from an existing type

BlitzMax Forums/BlitzMax Programming/Create an extended type from an existing type

http://www.blitzmax.com/Community/posts.php?topic=60010#669591

Long topic, but I edited the first post to reflect the solution

The basic answer is as long as the NEW isnt inside the function you use to allocate the values for the first object, than yes. What I tend to do now, is have a "Set" method and a "create" function, then the extended type calls its own create, which calls both sets.
Type TRGB                               'A Colour Tri
'				--------------------------------------------------------------------
	Field F_Red	:Int
	Field F_Green	:Int
	Field F_Blue	:Int
'				--------------------------------------------------------------------
	Method RM_Set:TRgb(P_Red:Int=0,P_Green:Int=0,P_Blue:Int=0)
	
		Self.F_Red	= P_Red
		Self.F_Green    = P_Green
		Self.F_Blue	= P_Blue
		Return Self
	
	End Method
'				--------------------------------------------------------------------
	Function RF_Create:TRgb(P_Red:Int=0,P_Green:Int=0,P_Blue:Int=0)
	
		Return New TRgb.RM_Set (P_Red,P_Green,P_Blue)
	
	End Function
'				--------------------------------------------------------------------
	Method RM_CreateCopy:TRgb()

		Return TRgb.RF_Create (Self.F_Red,Self.F_Green,Self.F_Blue)
	
	End Method
  Etc
EndType
Now if I extned RGB I only have to override the RF_Create, then from the new RF_Create calls the new Set, and the super Set. (Sorry about the syntax, but I didnt think you would would mind)