Topic: C++ and default parameters
Author: ldh@cs.brown.edu (Laurent Hasson)
Date: Fri, 10 Sep 1993 21:22:57 GMT Raw View
Well, i am all new here, and i have been using C for 3 years now, and
C++ for 1.5 year, and i have some questions about default
parameters...
void Foo( int i=1, int j=10, char* Str="toto", int* k=NULL)
Now, i would like to be able to do the folowing call...
Foo(,,,&t)
OK, this is not such a good example, but why should default arguments
be the trailing ones??? I had a case of a function which had many
arguments but most of the time, i was copying a vouple of default
arguments, and then having my actual arguments at the end. i was
forced to enter all the defaults preceeding the argument i wanted to
fill in. One could say that the header of the function was not well
designed, but then, you may have a function with 4,5, sometimes more
defaults. Finding the 'best' order is not always an easy, or possible,
thing to do???
bye...
My next message will on inheritance...
(spelling???)