Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung | |||
| modul:archiv:m320:learningunits:lu06:loesungen:lu07-aufgabe_5 [2026/08/30 14:06] – gelöscht - Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1 | modul:archiv:m320:learningunits:lu06:loesungen:lu07-aufgabe_5 [2026/08/30 14:06] (aktuell) – ↷ Seite von modul:m320:learningunits:lu06:loesungen:lu07-aufgabe_5 nach modul:archiv:m320:learningunits:lu06:loesungen:lu07-aufgabe_5 verschoben msuter | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | ===== Aufgabe 5 - Lösung ===== | ||
| + | ===Animal=== | ||
| + | <code python> | ||
| + | class Animal: | ||
| + | def __init__(self, | ||
| + | self._species = species | ||
| + | |||
| + | def move(self): | ||
| + | print(" | ||
| + | </ | ||
| + | ===Bird=== | ||
| + | <code python> | ||
| + | from animal import Animal | ||
| + | |||
| + | class Bird(Animal): | ||
| + | |||
| + | def __init__(self, | ||
| + | super().__init__(species) | ||
| + | self.__name = name | ||
| + | |||
| + | def move(self): | ||
| + | print(self._species + " mit Name " + self.__name + " fliegt" | ||
| + | </ | ||
| + | ===Cow=== | ||
| + | <code python> | ||
| + | from animal import Animal | ||
| + | |||
| + | class Cow(Animal): | ||
| + | |||
| + | def __init__(self, | ||
| + | super().__init__(species) | ||
| + | self.__name = name | ||
| + | |||
| + | def move(self): | ||
| + | print(self._species + " mit Name " + self.__name + " läuft" | ||
| + | </ | ||
| + | ===Fish=== | ||
| + | <code python> | ||
| + | from animal import Animal | ||
| + | |||
| + | class Fish(Animal): | ||
| + | |||
| + | def __init__(self, | ||
| + | super().__init__(species) | ||
| + | self.__name = name | ||
| + | |||
| + | def move(self): | ||
| + | print(self._species + " mit Name " + self.__name + " schwimmt" | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | [[https:// | ||