python3 组合的用法

 1 class Teacher:
 2     def __init__(self,name,bitrh,course):
 3         self.name=name
 4         self.birth=bitrh
 5         self.course=course
 6 
 7 class Course:
 8     def __init__(self,name,price,period):
 9         self.name=name
10         self.price=price
11         self.period=period
12 
13 class Date:
14     def __init__(self,year,mon,day):
15         self.year=year
16         self.mon=mon
17         self.day=day
18 
19 t=Teacher('egon',Date(1999,1,25),Course('python',11000,'4mons'))
20 print(t.birth.year)
View Code
原文地址:https://www.cnblogs.com/xp1005/p/6529868.html