How do I specify default argument values for a C++ constructor?

Viewed 33126

I have a constructor declaration as:

MyConstuctor(int inDenominator, int inNumerator);

and definition as

MyConstuctor::MyConstuctor(int inDenominator,
    int inNumerator, int inWholeNumber = 0)
{
    mNum = inNumerator;
    mDen = inDenominator;
    mWhole = inWholeNumber;
}

but i want to have an option of passing whole number as third parameter depending on caller object. is this the right way. if not what can be the alternative way.

3 Answers
Related