Answer to Question #52068 in C++ for Paula manzini

Question #52068
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);
Expert's answer
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.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be the first!

Leave a comment

Ask Your question

New on Blog