By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,915 Members | 1,361 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,915 IT Pros & Developers. It's quick & easy.

classes with optional parameters

P: n/a
how to writes classes or functions with optional parameters in c++ ?
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You must specify the default value in the function (constructor) prototype
defined in the header file, e.g.

// In header file:
...
int DoSomething(int nRequired, int nOptional = 0);
...

// In source file:
int MyClass::DoSomething(int nRequired, int nOptional)
{
...
}

All optional parameters must be at the end.

Alek
"gael" <an*******@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...
how to writes classes or functions with optional parameters in c++ ?

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.