一、面向对象的软件开发有如下几个阶段
1.面向对象分析(object oriented analysis ,OOA)
2 面向对象设计(object oriented design,OOD)
3 面向对象编程(object oriented programming,OOP)
4 面向对象测试(object oriented test,OOT)
5 面向对象维护(object oriendted soft maintenance,OOSM)
1 #对象:学校----->归类 2 #共有的特征:商标为etiantian 3 #共有的技能:招生 4 #独有的特征:地址不一样,老师们,课程 5 6 class School: 7 tag='etiantian' #共有特征 8 def __init__(self,addr): #独有特征 9 self.addr=addr 10 self.teacher_list=[] 11 self.course_list=[] 12 13 def zhaosheng(self): #共有技能 14 pass 15 16 17 #对象:老师---->归类 18 #共同的技能:教课 19 #独有的特征:名字,性别,level,课程 20 21 class Teacher: 22 23 def __init__(self,name,sex,level): 24 self.name=name 25 self.sex=sex 26 self.level=level 27 self.course_list=[] 28 29 def teach(self): 30 pass 31 32 33 #对象:学生---->归类 34 #共同的特征: 35 #共同的技能:search_score,handin 36 #独有的特征:学号,名字,性别,课程 37 class Student: 38 def __init__(self,ID,name,sex): #独有特征 39 self.id=ID 40 self.name=name 41 self.sex=sex 42 self.course_list=[] 43 def search_score(self): #共有技能 44 pass 45 46 def handin(self): 47 pass 48 49 class Course: 50 def __init__(self,name,price,period): 51 self.name=name 52 self.price=price 53 self.period=period 54 55 s1=Student('123123123123','cobila','female') 56 # print(s1.id,s1.name,s1.sex) 57 # print(s1.course_list) 58 # s1.course_list.append('python') 59 # s1.course_list.append('linux') 60 # print(s1.course_list) 61 62 python_obj=Course('python',15800,'7m') 63 linux_obj=Course('linux',19800,'2m') 64 65 66 s1.course_list.append(python_obj) 67 s1.course_list.append(linux_obj) 68 # print(s1.course_list) 69 70 print('''student name is:%s 71 course name is :%s 72 course price is :%s 73 ''' %(s1.name,s1.course_list[0].name,s1.course_list[0].price))