15.06.2013 Views

Dispensa in PDF - Dipartimento di Scienze Ambientali, Informatica e ...

Dispensa in PDF - Dipartimento di Scienze Ambientali, Informatica e ...

Dispensa in PDF - Dipartimento di Scienze Ambientali, Informatica e ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

f()<br />

Carnielli Efrem: Programmazione a componenti<br />

g()<br />

Figura 7.21. ere<strong>di</strong>tarietà con un l<strong>in</strong>guaggio che lo permette<br />

A<br />

C<br />

Def<strong>in</strong>izione ed uso <strong>di</strong> classi, oggetti ed <strong>in</strong>terfacce<br />

Supponiamo <strong>di</strong> avere o:C e chiamare o.f(). Questo è possibile perchè parto da un<br />

l<strong>in</strong>guaggio che consente ere<strong>di</strong>tà e mi permette <strong>di</strong> farlo. Ora voglio ottenerlo con un<br />

l<strong>in</strong>guaggio che non mi permette l’ere<strong>di</strong>tarietà.<br />

La soluzione è quella <strong>di</strong> utilizzare un attributo a:A con il quale richiamo la<br />

funzione f() <strong>di</strong> A.<br />

184

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

Saved successfully!

Ooh no, something went wrong!