I wander about this:
I wander which function would be called in a OOP language that supports Function overloading, as the x and y values are optional parameters for the second function.
I would rather do this, as it would make debugging a lot easier:
Type TestType Field Name$ Field x%, y% End Type Function SetValues(obj:TestType, MyString$) obj.Name$ = MyString$ End Function Function SetValues(obj:TestType, MyString$, x% = 0, y% = 0) obj.Name$ = MyString$ obj.x = x obj.y = y End Function newobj:TestType = New TestType SetValues(newobj, "My name") ' Which function would be called in a OOP language with function overloading?
I wander which function would be called in a OOP language that supports Function overloading, as the x and y values are optional parameters for the second function.
I would rather do this, as it would make debugging a lot easier:
Type TestType Field Name$ Field x%, y% End Type Function SetValues(obj:TestType, MyString$, x% = 0, y% = 0) obj.Name$ = MyString$ If x <> 0 Then obj.x = x If y <> 0 Then obj.y = y End Function newobj:TestType = New TestType SetValues(newobj, "My name")