Sunday, October 18, 2009

Default Parameters

Just a quick "Good-to-know:"

When setting default parameters, don't specify the parameters in both the header and the cpp file, rather specify in one or the other.

For example:
HEADER - prototype:

int popcorn (int oil = 1, int kernels = 50, int heat = 4);

FUNCTION - definition:
int popcorn (int oil, int kernels, int heat)
{
definition
};

No comments:

Post a Comment