IMHO optional parameters are a poor way of doing things.
For example, in
VB.NET I can write a method or function like this:
Public Sub foo(ByVal s as string, Optional ByVal b as Boolean = False)
//do something
End Sub
When this gets compiled by the Runtime the code will have an operator like this: [opt] denoting that the parameter is optional but in C# (or Java, JavaScript etc etc etc) there is no Optional Keyword and nor should there be as it defeats the purpose of overloading.
So, Rupen, using your example I would do something like this:
Public Function test(ByVal x as Integer) as Integer
Return x
End Function
Public Function test(ByVal x as Integer, ByVal y as Integer) as Integer
Return (x + y)
End Function
I know that this is a Classic ASP question so you will have to forgive the .NET code but Programming Theory is Programming Theory regardless of the language.
-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
^^Thats my signature