Answer to Question #52068 in C++ for Paula manzini
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);
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.