Stack has methods peek()
and pop()
, which affects the object on top of the stack, but since it inherits from other Classes, are there methods that can peek at eg. 4th element of the stack and pop 3rd element?
Why am I asking? I need to store 5 cards as a hand in five card draw game. I'd like to sort it from lowest to biggest value, and later get rid of few cards. Additional question: is it good idea to use stacks for it?