is there a way to do it without having to override the function?
Printable View
is there a way to do it without having to override the function?
In a prototype:
x's default value will be 0. the actual function definition might look like this:Code:void func(int x=0);
Note the lack of the =0. If you dont have the prototype, then you DO need to ad the =0 though.Code:void func(int x)
{
cout << x << endl;
}
Z.
i have to have a prototype?
cant just do
void test(int num=0){
//blah blah
}
You dont have to have the prototype, but f you do, only have the =0 in that prototype.
Z.