Unterricht Mittwoch
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
class Telefon:
|
||||
|
||||
def __init__(self, netz:str, *args):
|
||||
self.__netz = netz
|
||||
super().__init__(*args)
|
||||
|
||||
@property
|
||||
def netz(self) -> str:
|
||||
return self.__netz
|
||||
|
||||
@netz.setter
|
||||
def netz(self, netz:str):
|
||||
self.__netz = netz
|
||||
|
||||
# Python unterscheidet zwischen Klassenmethoden und statischen Methoden.
|
||||
# Eine Klassenmethode kann auf Klassenattribute über cls zugreifen. Eine statische Methode kann das nicht.
|
||||
@staticmethod
|
||||
def klingeln(anzahl:int = 1):
|
||||
print(anzahl * "*klingel*")
|
||||
|
||||
Reference in New Issue
Block a user