|
-
Apr 25th, 2002, 04:27 PM
#1
Thread Starter
Fanatic Member
optional parameters (without overriding)
is there a way to do it without having to override the function?
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 25th, 2002, 05:04 PM
#2
In a prototype:
Code:
void func(int x=0);
x's default value will be 0. the actual function definition might look like this:
Code:
void func(int x)
{
cout << x << endl;
}
Note the lack of the =0. If you dont have the prototype, then you DO need to ad the =0 though.
Z.
-
Apr 25th, 2002, 08:17 PM
#3
Thread Starter
Fanatic Member
i have to have a prototype?
cant just do
void test(int num=0){
//blah blah
}
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 25th, 2002, 09:19 PM
#4
You dont have to have the prototype, but f you do, only have the =0 in that prototype.
Z.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|