Fork me on GitHub
# class OldboyPeople:
# school = 'oldboy'
# def __init__(self,name,age,gender):
# self.name=name
# self.age=age
# self.gender=gender
# def tell_info(self):
# print('<名字:<%s> 年龄:<%s> 性别:<%s>' %(self.name,self.age,self.gender))
#
# class OldStudent(OldboyPeople):
# def __init__(self,name,age,gender,course,stu_id,year,mon,day):
# OldboyPeople.__init__(self,name,age,gender)
# self.course=course
# self.stu_id=stu_id
# self.year=year
# self.mon=mon
# self.day=day
# def tell_birth(self):
# print('出生日期是:<%s-%s-%s>' % (self.year, self.mon, self.day))
# def learn(self):
# print('%s is learning'%self.name)
# def tell_info(self):
# print('我是学生:',end='')
# OldboyPeople.tell_info(self)
#
# class OldTeacher(OldboyPeople):
# def __init__(self,name,age,gender,level,salary,year,mon,day):
# OldboyPeople.__init__(self,name,age,gender)
# self.level=level
# self.salary=salary
# self.year=year
# self.mon=mon
# self.day=day
# def tell_birth(self):
# print('出生日期是:<%s-%s-%s>'%(self.year,self.mon,self.day))
# def teach(self):
# print('%s is teaching'%self.name)
# def tell_info(self):
# print('我是老师:',end='')
# OldboyPeople.tell_info(self)
#
# stu1=OldStudent('婉婷',18,'female','python',1,2000,2,20)
# teacher1=OldTeacher('大侠',28,'female','10',10000,1990,6,6)
#
# stu1.tell_birth()
# teacher1.tell_birth()
'''
出生日期是:<2000-2-20>
出生日期是:<1990-6-6>
'''
# class OldboyPeople:
# school = 'oldboy'
# def __init__(self,name,age,gender):
# self.name=name
# self.age=age
# self.gender=gender
# def tell_info(self):
# print('<名字:<%s> 年龄:<%s> 性别:<%s>' %(self.name,self.age,self.gender))
#
# class OldStudent(OldboyPeople):
# def __init__(self,name,age,gender,course,stu_id):
# OldboyPeople.__init__(self,name,age,gender)
# self.course=course
# self.stu_id=stu_id
#
# def learn(self):
# print('%s is learning'%self.name)
# def tell_info(self):
# print('我是学生:',end='')
# OldboyPeople.tell_info(self)
#
# class OldTeacher(OldboyPeople):
# def __init__(self,name,age,gender,level,salary):
# OldboyPeople.__init__(self,name,age,gender)
# self.level=level
# self.salary=salary
# def teach(self):
# print('%s is teaching'%self.name)
# def tell_info(self):
# print('我是老师:',end='')
# OldboyPeople.tell_info(self)
#
# class Date:
# def __init__(self,year,mon,day):
# self.year=year
# self.mon=mon
# self.day=day
# def tell_birth(self):
# print('出生日期是:<%s-%s-%s>'%(self.year,self.mon,self.day))
#
# stu1=OldStudent('婉婷',18,'female','python',1)
# date_obj1=Date(2000,2,20)
# stu1.birth=date_obj1
# teacher1=OldTeacher('大侠',28,'female','10',10000)
# date_obj2=Date(1990,6,6)
# teacher1.birth=date_obj2
#
# print(stu1.birth)
# print(teacher1.birth)
# stu1.birth.tell_birth()
# teacher1.birth.tell_birth()
'''
<__main__.Date object at 0x000001A73C564708>
<__main__.Date object at 0x000001A73C564748>
出生日期是:<2000-2-20>
出生日期是:<1990-6-6>
'''
# class OldboyPeople:
# school = 'oldboy'
# def __init__(self,name,age,gender):
# self.name=name
# self.age=age
# self.gender=gender
# def tell_info(self):
# print('<名字:<%s> 年龄:<%s> 性别:<%s>' %(self.name,self.age,self.gender))
#
# class OldStudent(OldboyPeople):
# def __init__(self,name,age,gender,course,stu_id):
# OldboyPeople.__init__(self,name,age,gender)
# self.course=course
# self.stu_id=stu_id
#
# def learn(self):
# print('%s is learning'%self.name)
# def tell_info(self):
# print('我是学生:',end='')
# OldboyPeople.tell_info(self)
#
# class OldTeacher(OldboyPeople):
# def __init__(self,name,age,gender,level,salary):
# OldboyPeople.__init__(self,name,age,gender)
# self.level=level
# self.salary=salary
# def teach(self):
# print('%s is teaching'%self.name)
# def tell_info(self):
# print('我是老师:',end='')
# OldboyPeople.tell_info(self)
#
# class OldSale(OldboyPeople):
# def __init__(self,name,age,gender,kpi):
# OldboyPeople.__init__(self, name, age, gender)
# self.kpi=kpi
#
# def tell_info(self):
# print('我是销售:', end='')
# OldboyPeople.tell_info(self)
#
# class Date:
# def __init__(self,year,mon,day):
# self.year=year
# self.mon=mon
# self.day=day
# def tell_birth(self):
# print('出生日期是:<%s-%s-%s>'%(self.year,self.mon,self.day))
#
# sale1=OldSale(9527,28,'female',9.7)
# sale1.tell_info()
# date_obj=Date(1990,6,6)
# sale1.birth=date_obj
# sale1.birth.tell_birth()
'''
我是销售:<名字:<9527> 年龄:<28> 性别:<female>
出生日期是:<1990-6-6>
'''
# class OldboyPeople:
# school = 'oldboy'
# def __init__(self,name,age,gender,date_obj):
# self.name=name
# self.age=age
# self.gender=gender
# self.birth=date_obj
# def tell_info(self):
# print('<名字:<%s> 年龄:<%s> 性别:<%s>' %(self.name,self.age,self.gender))
#
# class OldStudent(OldboyPeople):
# def __init__(self,name,age,gender,course,stu_id,date_obj):
# OldboyPeople.__init__(self,name,age,gender,date_obj)
# self.course=course
# self.stu_id=stu_id
#
# def learn(self):
# print('%s is learning'%self.name)
# def tell_info(self):
# print('我是学生:',end='')
# OldboyPeople.tell_info(self)
#
# class OldTeacher(OldboyPeople):
# def __init__(self,name,age,gender,level,salary,date_obj):
# OldboyPeople.__init__(self,name,age,gender,date_obj)
# self.level=level
# self.salary=salary
# def teach(self):
# print('%s is teaching'%self.name)
# def tell_info(self):
# print('我是老师:',end='')
# OldboyPeople.tell_info(self)
#
# class OldboySale(OldboyPeople):
# def __init__(self,name,age,gender,kpi,date_obj):
# OldboyPeople.__init__(self, name, age, gender,date_obj)
# self.kpi=kpi
#
# def tell_info(self):
# print('我是销售:', end='')
# OldboyPeople.tell_info(self)
#
# class Date:
# def __init__(self,year,mon,day):
# self.year=year
# self.mon=mon
# self.day=day
# def tell_birth(self):
# print('出生日期是:<%s-%s-%s>'%(self.year,self.mon,self.day))
#
# date_obj1=Date(1990,6,6)
# sale1=OldboySale(9527,28,'female',9.7,date_obj1)
# sale1.birth.tell_birth()
'''
出生日期是:<1990-6-6>
'''
# class OldboyPeople:
# school = 'oldboy'
# def __init__(self,name,age,gender,date_obj):
# self.name=name
# self.age=age
# self.gender=gender
# self.birth=date_obj
# def tell_info(self):
# print('<名字:<%s> 年龄:<%s> 性别:<%s>' %(self.name,self.age,self.gender))
#
# class OldStudent(OldboyPeople):
# def __init__(self,name,age,gender,stu_id,date_obj):
# OldboyPeople.__init__(self,name,age,gender,date_obj)
# self.courses=[]
# self.stu_id=stu_id
#
# def learn(self):
# print('%s is learning'%self.name)
# def tell_info(self):
# print('我是学生:',end='')
# OldboyPeople.tell_info(self)
#
# class OldTeacher(OldboyPeople):
# def __init__(self,name,age,gender,level,salary,date_obj):
# OldboyPeople.__init__(self,name,age,gender,date_obj)
# self.level=level
# self.salary=salary
# self.courses=[]
# def teach(self):
# print('%s is teaching'%self.name)
# def tell_info(self):
# print('我是老师:',end='')
# OldboyPeople.tell_info(self)
#
# class OldboySale(OldboyPeople):
# def __init__(self,name,age,gender,kpi,date_obj):
# OldboyPeople.__init__(self, name, age, gender,date_obj)
# self.kpi=kpi
#
# def tell_info(self):
# print('我是销售:', end='')
# OldboyPeople.tell_info(self)
#
# class Date:
# def __init__(self,year,mon,day):
# self.year=year
# self.mon=mon
# self.day=day
# def tell_birth(self):
# print('出生日期是:<%s-%s-%s>'%(self.year,self.mon,self.day))
#
# class Course:
# def __init__(self,name,price,period):
# self.name=name
# self.price=price
# self.period=period
# def tell_info(self):
# print('课程详细信息:<%s,%s,%s>'%(self.name,self.price,self.period))
# Python=Course('自动化养猪',3000,'3mon')
# Linux=Course('大数据',3000,'3mon')
# date_obj=Date(1995,1,24)
#
# # teacher=OldTeacher('egon',18,'male',10,30000,date_obj)
# # teacher.courses.append(Python)
# # teacher.courses.append(Linux)
# #
# # for course in teacher.courses:
# # course.tell_info()
# '''
# 课程详细信息:<自动化养猪,3000,3mon>
# 课程详细信息:<大数据,3000,3mon>
'''
stu=OldStudent('婉婷',18,'female',1,date_obj)
print(stu.courses)
'''
# []
# '''
# stu.courses.append(Python)
# stu.courses.append(Linux)
# print(stu.courses)
'''
[<__main__.Course object at 0x0000014536A74E48>, <__main__.Course object at 0x0000014536A74E88>]
'''
posted on 2019-12-23 12:30  OBOS  阅读(187)  评论(0编辑  收藏  举报