Classi astratte ed interfacce - Dipartimento di Ingegneria Informatica ...
Classi astratte ed interfacce - Dipartimento di Ingegneria Informatica ...
Classi astratte ed interfacce - Dipartimento di Ingegneria Informatica ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Interfacce<br />
A. Longheu – Linguaggi M-Z – Ing. Inf. 2009-2010<br />
Una interfaccia costituisce una pura specifica <strong>di</strong> interazione<br />
contiene solo <strong>di</strong>chiarazioni <strong>di</strong> meto<strong>di</strong>, <strong>ed</strong> eventualmente<br />
costanti<br />
ma non variabili né implementazioni <strong>di</strong> meto<strong>di</strong><br />
Praticamente, una interfaccia è strutturalmente analoga a una<br />
classe, ma è introdotta dalla parola chiave interface anziché class<br />
Le <strong>interfacce</strong> inducono un <strong>di</strong>verso modo <strong>di</strong> concepire il progetto:<br />
prima si definiscono le <strong>interfacce</strong> delle entità che costituiscono<br />
il sistema<br />
in questa fase si considerano scelte <strong>di</strong> progetto (pulizia<br />
concettuale)<br />
poi si realizzeranno le classi che implementeranno tali<br />
<strong>interfacce</strong><br />
in questa fase entreranno in gioco scelte implementative<br />
(efficienza <strong>ed</strong> efficacia)<br />
18