python程序设计与分析第7章--教案.pptxVIP

  • 59
  • 0
  • 约5.86千字
  • 约 17页
  • 2020-11-10 发布于四川
  • 举报
1 第7章 面向对象程序设计 主要内容 类的继承 类和对象 多态与重载 模块与类 2 2020-11-10 声明类 class 类名: 成员变量 成员函数 定义类的对象 对象名=类名() 定义和使用类 ===类和对象=== class person: def SayHello(self): print(hello class!) p=person() p.SayHello() 成员变量 公有变量 私有变量 __xxx class per1: str=Myfirst __t=Yes def output(self): print(self.str) print(self.__t) def m(): p=per1() print(p.str) p.output() m() 3 2020-11-10 构造函数 def __init__(self,其他参数): 语句块 析构函数 def __del()__(self) 定义和使用类 ===类和对象=== class MyS: def __init__(self): self.str=MyString

文档评论(0)

1亿VIP精品文档

相关文档