codice:MyFile /** * A class to manage files * @author Simone * */ public class MyFile { public MyFile() { /* * Non inizializza nulla. Il mio primo dubbio è proprio su questo costrut- * tore: non capisco perchè devo creare un costruttore vuoto, senza pare- * metri espliciti. Dall'altro lato, se non lo creo, tutte le sottoclassi * presentano un errore */ } /* * Costruisce un nuovo file coi parametri stabiliti * @param type tipo file (audio, testo, immagine, video) * @param path percorso file * @param size grandezza file */ public MyFile(String type, String path, int size) { this.type = type; this.path = path; this.size = size; } /* * da qui in avanti ci sono tutti i metodi getters e setters dei costruttori * della classe */ public String getType() { return type; } public String getPath() { return path; } public int getSize() { return size; } public void setType(String type) { this.type = type; } public void setPath(String path) { this.path = path; } public void setSize(int size) { this.size = size; } private String type; private String path; private int size; } ///////////////// AudioFile /** * A class to manage audio files * @author Simone * */ public class AudioFile extends MyFile { public AudioFile(String type, String path, int size, int length) { super.setType(type); super.setPath(path); super.setSize(size); this.length = length; } public int getLength() { return length; } private int length; }