Hey Danny,
Not all languages support optional parameters.
--
Bobby C. Jones
http://www.acadx.com
"Danny P." wrote in message
news:4899508@discussion.autodesk.com...
I have very little knowledge of overloaded functions, but it seems to me
that your situation could be handled with an Optional parameter instead
of an overloaded function (not true?):
Sub Foo (Optional x as Int32 = "0")
I thought Overloaded functions were meant to handle situations (in
addition to optional parameters) where parameters were of a different type:
Sub FreezeLayer (LayerName As String)
Sub FreezeLayer (Layer As AcadLayer)
This prevents the need for using Objects as parameters, then determining
if the Object is of a certain type within the function. Am I on the
right track here? Is the use of Optional parameters not encouraged?
Thanks,
Danny Polkinhorn
WATG
Honolulu
Tony Tanzillo wrote:
> It depends on what the overloaded functions are doing.
>
> In many cases, I overload only as a means of providing
> optional arguments, like this:
>
> public void Foo(int x)
> {
> // ..
> }
>
> public void Foo()
> {
> Foo(0); // default value when argument is not supplied
> }
>
> That's one scenario (and the most common). There are others.
> In cases where there is a lot of replication between different
> versions of the same overloaded function, I often write one 'main'
> overload that does most of the work, and have the others call it
> internally.
>