|
Data Structures and Algorithms
with Object-Oriented Design Patterns in Python |
The implementation of the StackAsLinkedList class makes use of one instance attribute--an instance of the LinkedList class called _list. In addition, the StackAsLinkedList class inherits the _count instance attribute from the Container class. This list is used to keep track of the objects in the stack. As a result, there are as many elements in the linked list as there are objects in the stack.