Question: You need to write a class, named Penultimate. This class has just one method ( member function ) named push _ back, that takes a

You need to write a class, named "Penultimate". This class has just one method (member function) named push_back, that takes a string and returns a string. The string returned by push_back is the string that was provided to push_back in the previous call of the method (or the string provided to the constructor if this is the first call to push_back.
Example:
Penultimate p("first");
string s = p.push_back("second"); // s is "first"
p.push_back("Third"); // returns "second"
p.push_back("last"); // returns "Third"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!