warum kann ich nicht den Zugriff auf geschützte java-Methode auch gedacht, ich habe erweitert die Klasse?

Hier ist die Dokumentation für die geschützte Methode:

/** Converts jmusic score data into a MIDI Sequence */
protected  javax.sound.midi.Sequence scoreToSeq(Score score)

Gemacht und ich dieses kleine Klasse, die Klasse zu erweitern, dass scoreToSeq-Methode stammt von:

public class MidiSequence extends MidiSynth{

    public Sequence getSequence(Score score){
        MidiSynth synth = new MidiSynth();
        Sequence sequence = null;
        try
        {
                    //Here I get the error saying that the method has
                    //protected access in MidiSynth
            sequence = synth.scoreToSeq(score);

        }
        catch (InvalidMidiDataException e)
        {
            /*
             *  In case of an exception, we dump the exception
             *  including the stack trace to the console.
             *  Then, we exit the program.
             */
            e.printStackTrace();
            System.exit(1);
        }

        return sequence;

    }
}
  • Von Najib Tounsi (nicht genug rep Kommentar) : Auch wenn synth.scoreToSeq(score); sollte legal sein.
InformationsquelleAutor Matt | 2009-10-25
Schreibe einen Kommentar