Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!cica!iuvax!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!nelson From: nelson@m.cs.uiuc.edu Newsgroups: comp.lang.c++ Subject: functions as default parameters Message-ID: <4800087@m.cs.uiuc.edu> Date: 26 Feb 90 23:18:00 GMT Lines: 18 Nf-ID: #N:m.cs.uiuc.edu:4800087:000:526 Nf-From: m.cs.uiuc.edu!nelson Feb 26 17:18:00 1990 Well, today I discovered that default parameters can be a function, that is to say that the following is legal: class Fred { public: void bill (int b = printf ("default")) {}; } Now what I would _like_ to do is: class Jim { public: void printData (char *data, int length = strlen (data)) {}; } (That is to say that we can assume that if length is not supplied, then the passed data is actually a string.) But it gets upset since "data" is not yet defined/in that scope. Is there a way to get around this???