Method Overloading?

BlitzMax Forums/BlitzMax Programming/Method Overloading?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Tch Tch Tch Guys.

What about Method Overloading?

The following code snippet should work in a true OOP programming environment:

Type Coords2D
	Field x, y
End Type

Type Dimensions2D
	Field w,h
End Type

Type Colour
	Field r,g,b
End Type

'Base abstract class for a basic gadget.
Type Gadget Abstract

	Field Name$

	'Position and size attributes.
	Field Position:Coords2D = new Coords2D
	Field Size:Dimensions2D = new Dimensions2D
	Field ZOrder
	
	'Behavior
	Field HasFocus
	Field TabOrder
	Field Visible
	Field Enabled
	
	Method Draw()	Abstract
	
End Type

'Simple Label Gadget
'------------------------------------------
Type Label Extends Gadget

	Field Text:String
	
        'First Static Create Method
	Function Create:Label(txt:String)
		Local lbl:Label = New Label
		lbl.Text = txt
		Return lbl
	End Function
	
        'Overloaded Static Create Method
	Function Create:Label(txt:String, x:Int, y:Int)
		Local lbl:Label = New Label
		lbl.Text = txt
		lbl.Position.x = x
		lbl.Position.y = y
		Return lbl
	End Function

        Method Draw()
           'Do something here
        End Method

End Type


Instead I get an error stating that the Create function is defined twice. I Do hope this is something that will be rectified in the future.

-Jim