Description
A. | ||
B. | ||
C. | ||
D. |
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.Review
Review
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Similar Content
Related Tags
Tess of the DUrbervilles
by Thomas Hardy
Little Women
by Louisa May Alcott
Where the Crawdads Sing
by Delia Owens
The Road
by Cormac McCarthy
Of Mice and Men
by John Steinbeck
The Tipping Point
by Malcolm Gladwell
Oliver Twist
by Charles Dickens
Pride and Prejudice
by Jane Austen
Orphan Train
by Christina Baker Kline