With the below pseudo code? Am I breaking any SOLID principles?
interface i_pet
string get_name()
string get_species()
color get_fur_color()
end interface
interface i_cat implements i_pet
end interface
interface i_fish implements i_pet
bool get_is_fresh_water()
end interface
class cat implements i_cat
string name
string species
color fur_color
cat(string name, string species, color fur_color):
this.name = name
this.species = species
this.fur_color = fur color
string get_species():
return species
string get_name():
return name
color get_fur_color:
return fur_color
end class
class fish implements i_fish
string name
string species
bool is_fresh_water
string get_species():
return species
string get_name():
return name
color get_fur_color():
throw exception
bool get_is_fresh_water():
return is_fresh_water
end class
class pet_printer
print_pet_name(i_pet pet):
print pet.get_name()
print_fur_color(i_pet pet):
print pet.get_fur_color()
print_pet_species(i_pet pet):
print pet.get_species()
print_pet_type(i_pet pet):
switch type of pet:
case i_fish:
print "Fish";
case i_cat:
print "Cat";
default:
print "Unkown";
end switch
end class
I think I'm breaking the Interface segregation principle
with i_pet having get_fur_color
but I can't identify any other issues?