Overload Constructs

  • Thread starter Thread starter portroe
  • Start date Start date
P

portroe

What would be a typical scenario or real-world reason to us Overload
constructs,

thanks

portroe
 
You might want to initialise class with or without setting values

Dim P = New cPreset( 20 )
Dim P2 = New cPreset()


Class cPreset

Dim presetValue as Integer

Sub New ( iPresetValue as Integer )
PresetValue=iPresetValue ' Value passed
End Sub

Sub New ( )
PresetValue=10 ' Default
End Sub



End Class


What would be a typical scenario or real-world reason to us Overload
constructs,

thanks

portroe

Best Regards - OHMBest Regards - OHM (e-mail address removed)
 
* portroe said:
What would be a typical scenario or real-world reason to us Overload
constructs,

For example, passing data which is needed to instantiate an object.
Have a look at the classes in the .NET framework and you will see when
overloading the ctor makes sense.
 
Back
Top