Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   c++ default value in function call (http://www.go4expert.com/forums/cpp-default-value-function-t8748/)

saravanan_ 11Feb2008 11:58

c++ default value in function call
 
hi ,
I am new to this forum. Any one pls. give me a solution for my problem.
i have a c++ function
void func(int a=10,int b=20)
{
..........
}

i need to call the function with only one argument depends on certain condition.
some time i need call with two arguments.
I tired with two arguments and with one in first argument say
func(12);
the above one is working but, i want to call the function with
func(,59);
pls give me a solution for the above one.

Thanks in advance..

shabbir 11Feb2008 13:02

Re: c++ default value in function call
 
You need to pass a value for the first argument always. It cannot be that you don't provide an argument for the first in the list. You can use 0 of course.

saravanan_ 11Feb2008 14:53

Re: c++ default value in function call
 
First of all Thanks .....shabbir for your reply...
So i have to pass the 1st and 2nd argument also...
Actually in PL/SQL it is possible to pass the 2nd args only, that why i asked this question.
Once again thanks for the reply..


All times are GMT +5.5. The time now is 14:03.