vendredi 8 janvier 2021

Is it okay to return null from overriden abstract method

I have a class SpecialSender witch extends abstract class Sender. In abstract class there is method sendFile but my sender just sends plain String so I don't want to use sendFile. Is it a good practice to do:

    @Override
    protected String sendFile(Product product, Type type) {
        return null;
    }

or should use some exception or there is different way to do it in better manner e.g I shouldn't extend Sender at all?

Aucun commentaire:

Enregistrer un commentaire