07.06.2013 Views

Classi astratte ed interfacce - Dipartimento di Ingegneria Informatica ...

Classi astratte ed interfacce - Dipartimento di Ingegneria Informatica ...

Classi astratte ed interfacce - Dipartimento di Ingegneria Informatica ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

A. Longheu – Linguaggi M-Z – Ing. Inf. 2009-2010<br />

<strong>Classi</strong> <strong>astratte</strong> - Esempio<br />

public class PesceDiMare extends AnimaleMarino {<br />

public PesceDiMare(String s)<br />

{super(s);<br />

verso = "non fa versi"; }<br />

public String chi_sei()<br />

{return "un pesce (<strong>di</strong> mare)"; }<br />

public String si_muove() {<br />

return "nuotando"; }<br />

}<br />

Definisce l’ultimo metodo astratto rimasto si_muove(). La classe<br />

non è più astratta<br />

12

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

Saved successfully!

Ooh no, something went wrong!