zoukankan      html  css  js  c++  java
  • 面向对象的程序设计---组合练习

    class Birth:
        def __init__(self,year,month,day):
            self.year=year
            self.month=month
            self.day=day
    class Couse:
        def __init__(self,name):
            self.name=name
    class Score:
        def __init__(self,score):
            self.score=score
    
    class people:
        def __init__(self,name,birth,couse):
            self.name=name
            self.birth=birth
            self.couse=couse
    class Teacher(people):
        pass
    class Student(people):
        def __init__(self,name,birth,couse,score):
            people.__init__(self,name,birth,couse)
            self.score=score
    t1=Teacher("苍老师",Birth("1985","11","11"),Couse("python"))
    s1=Student("加藤同学",Birth("1975","3","15"),Couse("二指禅"),Score("666"))
    print(s1.name,
          "出生于:",s1.birth.year,s1.birth.month,s1.birth.day,
          "目前专业:",s1.couse.name,
          "成绩:",s1.score.score)
    

      

  • 相关阅读:
    mysql学习总结(四)
    mysql学习总结(三)
    mysql学习总结(二)
    mysql学习总结
    学习总结(三十)
    断点续传
    错误总结
    学习总结(三十六)
    学习总结(三十五)
    Linux命令
  • 原文地址:https://www.cnblogs.com/mrpengfei/p/6734291.html
Copyright © 2011-2022 走看看