Ask your own question, for FREE!
Computer Science 25 Online
OpenStudy (anonymous):

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

OpenStudy (rsmith6559):

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.

OpenStudy (anonymous):

@rsmith6559 what i dont understand is that i am supposed to use composition while writing this

OpenStudy (rsmith6559):

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.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!