|
| 1 | +#Dies soll ein Beispiel für eine Klasse sein in Python |
| 2 | + |
| 3 | +class make(): |
| 4 | + def __init__ (self,color,length,height): |
| 5 | + color = self.color |
| 6 | + length = self.length |
| 7 | + height = self.height |
| 8 | + def car(color,length,height): |
| 9 | + print ("""The color is %s,the length is %s,The length is %s""" % (color,length,height)) |
| 10 | + |
| 11 | +# make.car("red","2.5","3") Beispielausführung des Programms |
| 12 | + |
| 13 | +class do(make): |
| 14 | + pass |
| 15 | + |
| 16 | +# Beispiel von Klassenverebung in Python |
| 17 | +# do.car("red","2.5","3") Die Methode von der Klasse make wird vererbt |
| 18 | + |
| 19 | +# Alpay Yildirim 06.08.2014 Python 3.4.1 |
0 commit comments