Function Overloading in ASP.NET?

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
 
M

Marina

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
 
K

Kivak Wolf

Yes, I ended up trying myself after I posted. But thanks alot. =) It
works just fine.

Kivak Wolf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top