Programming Essentials question 14

User Generated

zrrxn76

Programming

Description

You can write as many constructors for a class as you want, as long as they all have different ____ lists.
A.
B.
C.
D.

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

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;

} };



ANSWER:  D. Parameter

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

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

Please let me know if you need any clarification. I'm always happy to answer your questions.


Anonymous
Just the thing I needed, saved me a lot of time.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Similar Content

Related Tags