April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Replace Inheritance With Delegation (352)
nExemplo: pilha subclasse de vetor.
n
nClass MyStack extends Vector {
n
n public void push (Object element) {
n insertElementAt (element, 0);
n}
n
n public Object pop () {
n Object result = firstElement ();
n removeElementAt (0);
n return result;
n}