chanman
|
ok I have this function:
void fadeIn(int duration, int color, int image) {
//blah
}
can I make a default value for image for example:
void fadeIn(int duration, int color, int image = 0) {
//blah
}
so if the coder does not need to show an image, s/he can just call the function with the first 2 arguments?
eg. fadeIn( 500, RGB(255, 255, 255));
Posted on 2004-09-15 19:00:35 (last edited on 2004-09-15 19:05:03)
|
vecna
|
I'll elaborate a bit: Default parameters are tricky in verge because there's only two basic data types. As most functions just take a varying number of ints as arguments, its very difficult to be able to 'default' more than one arguement since you have no way of knowing which parameter is which.
I've always felt default arguements in most languages were a hackish construct anyway. SAS macro functions support default arguments, but when you call them you do %myfunc(arg1=foo arg2=barr), so its easy to know which arguements are actually being passed and which are being defaulted. Most c-like languages don't work that way. Overrides would be a more useful addition to VC, and is possible, but not a priority at this time.
Posted on 2004-09-16 05:16:16
|