Which, if any, of the following statements are untrue? Why
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:7| Question number:46
All Answers
total answers (1)
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:7| Question number:46
total answers (1)
(a) A class must provide at least one constructor.
True. If the programmer doesn't provide any constructor, the compiler will synthesise one default constructor.
(b) A default constructor is a constructor with an empty parameter list.
Untrue. A constructor of which all parameters have default values also defines a default constructor.
(c) If there are no meaningful default values for a class, the class should not provide a default constructor.
True. <!--- Need more consideration. --->
(d) If a class does not define a default constructor, the compiler generates one that initializes each data member to the default value of its associated type.
Untrue. Only if a class does not define **any constructors**, will the compiler generate synthesised default constructor.
need an explanation for this answer? contact us directly to get an explanation for this answer