摘要: class Car(): def __init__(self,speed:'int >=10' = 10,price = 10) -> None:# 函数的静态注释,:号后跟字符串解释 self.speed = speed self.price = price def run(self):#每个函数 阅读全文
posted @ 2021-12-04 14:01 shuiyihang 阅读(42) 评论(0) 推荐(0)
摘要: 类的写法 模板: class Car { public: ... private: ... }; 实例: class Car { public: // 初始化函数没有返回值,参数列表可能为空,函数体可能为空 Car() { cout<< "父类无参构造"<<endl; } Car(int speed 阅读全文
posted @ 2021-12-04 13:39 shuiyihang 阅读(74) 评论(0) 推荐(0)