Is the following declaration legal? If not, why not
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:7| Question number:44
All Answers
need an explanation for this answer? contact us directly to get an explanation for this answer
It is illegal, the constructor of `vector` taken a single number will call the default constructor of elements to value initialze its elements, but the class of the elements `NoDefault` does not have a default constructor, thus the code will not compile.
need an explanation for this answer? contact us directly to get an explanation for this answer
total answers (2)

C++ programming
It is illegal, the constructor of
`vector`taken a single number will call the default constructor of elements to value initialze its elements, but the class of the elements`NoDefault`does not have a default constructor, thus the code will not compile.
need an explanation for this answer? contact us directly to get an explanation for this answer