Animal
class Animal:
def __init__(self, species):
self._species = species
def move(self):
print("Tier weiss nicht konkret, wie es sich bewegen soll")
Bird
from animal import Animal
class Bird(Animal):
def __init__(self, species, name):
super().__init__(species)
self.__name = name
def move(self):
print(self._species + " mit Name " + self.__name + " fliegt")
Cow
from animal import Animal
class Cow(Animal):
def __init__(self, species, name):
super().__init__(species)
self.__name = name
def move(self):
print(self._species + " mit Name " + self.__name + " läuft")
Fish
from animal import Animal
class Fish(Animal):
def __init__(self, species, name):
super().__init__(species)
self.__name = name
def move(self):
print(self._species + " mit Name " + self.__name + " schwimmt")
© René Probst