1 Star 0 Fork 0

Python程序设计/20181312xieyi_can

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Class_test.py 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
XieYi 提交于 2020-04-08 21:49 . 类的封装继承多态
class Course:
name = ' '
credit = ' '
def __init__(self, name, credit):
Course.name = name
Course.credit = credit
print("课程名:" + Course.name + " 课程学分:" + Course.credit)
def _reset_course(self, name, credit):
Course.name = name
Course.credit = credit
print("课程名:" + Course.name + " 课程学分:" + Course.credit)
class InformationSecurity(Course):
number_of_people = ' '
teacher = ' '
def _set_IS(self, number_of_people, teacher):
InformationSecurity.number_of_people = number_of_people
InformationSecurity.teacher = teacher
print(InformationSecurity.name + " 为" + InformationSecurity.credit + "学分课程,由"
+ InformationSecurity.teacher + "授课,课堂人数为" + InformationSecurity.number_of_people)
def _reset_course(self, name, credit, number_of_people, teacher):
InformationSecurity.name = name
InformationSecurity.credit = credit
InformationSecurity.number_of_people = number_of_people
InformationSecurity.teacher = teacher
print(InformationSecurity.name + " 为" + InformationSecurity.credit + "学分课程,由"
+ InformationSecurity.teacher + "授课,课堂人数为" + InformationSecurity.number_of_people)
cipher = Course("密码学", "4")
cipher._reset_course("密码分析学", "4")
Is1 = InformationSecurity("信息安全", "4")
Is1._set_IS("70", "张三")
Is1._reset_course("信息安全攻击","8","30","李四")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/python_programming/xieyi_can20181312.git
git@gitee.com:python_programming/xieyi_can20181312.git
python_programming
xieyi_can20181312
20181312xieyi_can
master

搜索帮助