Thank you for the opportunity to help you with your question!

-------------------------------------------------------------------------------------------------------------

You can write as many constructors for a class as you want, as long as they all have different parameter lists.

For example, the class Fraction below has two constructors that have different parameter lists.

class Fraction{private: intm_nNumerator; intm_nDenominator;public: Fraction()// default constructor { m_nNumerator=0; m_nDenominator=1; } // Constructor with parameters Fraction(int nNumerator, intn Denominator=1) { assert(nDenominator!=0); m_nNumerator=nNumerator; m_nDenominator=nDenominator; } };

class Fraction

{

private:

intm_nNumerator;

intm_nDenominator;

public:

Fraction()// default constructor

m_nNumerator=0;

m_nDenominator=1;

}

// Constructor with parameters

Fraction(int nNumerator, intn Denominator=1)

assert(nDenominator!=0);

m_nNumerator=nNumerator;

m_nDenominator=nDenominator;

} };

ANSWER: D. Parameter

SOURCE: http://www.learncpp.com/cpp-tutorial/85-constructors/

Secure Information

Content will be erased after question is completed.

Enter the email address associated with your account, and we will email you a link to reset your password.

Forgot your password?

Sign Up