Create a class called Stack that contains an array of Tally objects reusing the code for tallies you created in week 6. The array should be a private member. Implement public member functions push and pop to add Tally objects to the stack and return Tally objects from the top of the sack respectively. i need help getting started or understanding what i am supposed to do
You're writing a class that implements a stack (LIFO, Last In First Out) data structure using an array of Tally objects that can only be accessed from outside the class via a pop() and push() functions that you'll be writing.
@rsmith6559 what i dont understand is that i am supposed to use composition while writing this
The Stack class is implementing stack behavior using an array ( vector? ) to store the stack. Storage is one aspect of a stack. Adding, removing, and managing the storage are other aspects of a stack. Therefore, the storage has an "is part of" relationship with the class.
Join our real-time social learning platform and learn together with your friends!