Function Overloading in ASP.NET?

  • Thread starter Thread starter Kivak Wolf
  • Start date Start date
K

Kivak Wolf

Hey, Simple question. Can I do this?

Function MyFunction()
##Code##
End Function

Function MyFunction(ByVal myVar as myType)
##code##
End Function

That way, I can call "MyFunction" and pass it a variable if I have one,
and call it without one if I don't? I know some languages hate this,
but I came from C++ which "loves" it. Does anyone know if this is
allowed?

Thanks,
Kivak Wolf
 
Wouldn't this be easy to try?

In any case, yes both C# and VB have overloading. VB doesn't force you to
declare a return type for a function, but you should. Something like:

Function MyFunction() As SomeType
 
Yes, I ended up trying myself after I posted. But thanks alot. =) It
works just fine.

Kivak Wolf
 
Back
Top