Uebung 05
This commit is contained in:
20
uebung_05/exercise_01/exercise_01.py
Normal file
20
uebung_05/exercise_01/exercise_01.py
Normal file
@ -0,0 +1,20 @@
|
||||
class Ball:
|
||||
__diameter__ = 0.0
|
||||
|
||||
## Methods
|
||||
# Constructor
|
||||
def __init__(self, diameter = 1.0):
|
||||
self.__diameter__ = diameter
|
||||
pass
|
||||
|
||||
# a simple method
|
||||
def introduction(self):
|
||||
print(f"My diameter is {self.__diameter__:.3f}.")
|
||||
pass
|
||||
|
||||
# main code
|
||||
a = Ball()
|
||||
b = Ball(2.0)
|
||||
|
||||
a.introduction()
|
||||
b.introduction()
|
Reference in New Issue
Block a user