11.05.2013 Views

Guia Trabajos Practicos - Departamento de Computación ...

Guia Trabajos Practicos - Departamento de Computación ...

Guia Trabajos Practicos - Departamento de Computación ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Programación Orientada a Objetos Facultad <strong>de</strong> Ciencias Exactas - UBA<br />

Evaluar MyClass new test1 y MyClass new test2 da:<br />

a) true true<br />

b) true false<br />

c) false true<br />

d) false false<br />

7. Analice el resultado <strong>de</strong> los siguientes mensajes<br />

A<br />

m1 : ^ 'A'<br />

m8 : ^ self m1<br />

m9 : ^ super m1<br />

m10 : ^ self m8<br />

m11 : ^ self m9<br />

m12 : ^ 'A'<br />

B<br />

m1 : ^ 'B'<br />

m2 : ^ self m1<br />

m3 : ^ super m1<br />

m12 : ^ 'B'<br />

C<br />

m1 : ^ 'C'<br />

m4 : ^ self m1<br />

m5 : ^ super m1<br />

m6 : ^ super m2<br />

m7 : ^ super m3<br />

a) C new m1<br />

b) C new m2<br />

c) C new m3<br />

d) C new m4<br />

e) C new m5<br />

f) C new m6<br />

g) C new m7<br />

h) C new m8<br />

i) C new m9<br />

j) C new m10<br />

k) C new m11<br />

l) C new m12<br />

Referencias:<br />

1. Chamond Liu. Smalltalk, Objects and Design. Página 54: Special variables self and super<br />

Method Lookup<br />

1. Escriba el algoritmo <strong>de</strong> MethodLookup<br />

2. ¿Pondría la ejecución <strong>de</strong>l method lookup <strong>de</strong>l lado <strong>de</strong>l emisor o <strong>de</strong>l lado <strong>de</strong>l receptor <strong>de</strong> un mensaje?<br />

3. ¿Qué ventajas nos brinda que el primero en enterarse <strong>de</strong> un MNU sea el receptor <strong>de</strong>l mensaje?<br />

4. ¿Podría el method lookup resolverse en un lenguaje dinámico al compilarse el método que se está<br />

programando? ¿Hay excepciones? ¿Y en lenguajes estáticamente tipados?<br />

5. Piense 3 ejemplos para qué le sería útil re<strong>de</strong>finir el MNU<br />

Referencias:<br />

1. Chamond Liu. Smalltalk, Objects and Design. Sección 16.2: Method lookup<br />

Material <strong>de</strong> lectura y trabajo guia 2011.doc Página 22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!