2.1. What is the effect of the following statements? If a statement is invalid, explain why it is invalid. The classes stackADT, stackType, and linkedStackType are as defined in this chapter.
2.1.1. stackADT<int> newStack;
2.1.2. stackType<double> sales(-10);
2.1.3. stackType<string> names;
2.1.4. linkedStackType<int> numStack(50);
1
Expert's answer
2015-04-16T03:30:17-0400
All 2.1.1, 2.1.3 and 2.1.4 aretrue, because C++ allows class variables initialization without new - then they will be stored in program stack. In 2.1.1 default constructor will be called, if it is defined in class; 2.1.3 is similar; in 2.1.4 overloaded constructor is called in which linked stack capacity is initialized by 50. 2.1.2 has a logical mistake -here is try to set negative capacity.
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment