|
-
Jul 31st, 2001, 11:09 PM
#1
Thread Starter
Addicted Member
Default param
how do you make a default value for a parameter
-
Jul 31st, 2001, 11:31 PM
#2
Hyperactive Member
here is an example:
Code:
void function(int x, int y=0)
{
//whatever in here
//if no value is passed for y, it'll be 0 by default..
}
Amon Ra
The Power of Learning.
-
Aug 1st, 2001, 12:27 AM
#3
Thread Starter
Addicted Member
Thanks
I wonder what the default keyword is for then?
If you put your C++ code
in php
PHP Code:
if then "this is a string"
tags it highlights the keywords nicely.
Last edited by Bjwbell; Aug 1st, 2001 at 12:30 AM.
-
Aug 1st, 2001, 11:57 AM
#4
Hyperactive Member
i knoe only one use of the default keyword:
PHP Code:
switch(x)
{
case 1: {}
case 2: {}
default: {}//basically, it does what's in these brackets if none of the cases above are met
}
Amon Ra
The Power of Learning.
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
|