1. 程式人生 > >week6:本週作業選課系統

week6:本週作業選課系統

"""
class Tearch:
    def __init__(self, name,age):
        self.name = name
        self.age = age
        self.salary = 1000

class Course:

    def __init__(self, name, cost, tearcher):
        self.name = name
        self.tearcher = tearcher
        self.cost = cost

    def class_up(self):
        self.tearcher.salary += self.cost



t1 = Tearch('李傑' ,8)
t2 = Tearch('李1', 9)
t3 = Tearch('李2', 10)

c1 = Course('生理課', 1, t1)

print(c1.name)
print(c1.tearcher.age)
print(c1.tearcher.name)
print(c1.tearcher.salary)

c1.class_up()

print(c1.tearcher.salary)
"""