Python:类的组合
来源:互联网 发布:海口seo外包 编辑:程序博客网 时间:2024/05/18 15:55
class Turtle: def __init__(self,x): self.num=xclass Fish: def __init__(self,x): self.num=xclass Pool: def __init__(self,x,y): self.turtle=Turtle(x) self.fish=Fish(y) def print_num(self): print('水池里总共有乌龟%d只,小鱼%d条'%(self.turtle.num,self.fish.num))pool=Pool(1,10)print(pool.print_num())
阅读全文
0 0
- Python:类的组合
- python类的组合应用
- 什么是Python类的组合?
- Python的标准UT组合
- [Python]常用的组合数据类型
- Python组合的实例用法
- Python 组合
- PYTHON组合
- python很巧妙的列表组合itertools
- 1056. 组合数的和(15)--Python
- 类的组合
- 类的组合特性
- C++类的组合
- 类的继承/组合
- 类的组合
- 类的组合问题
- 类的组合
- C++类的组合
- [Poi2012] bzoj 2788 Festival
- D
- 在eclipse中使用Maven创建spring+springMVC工程
- 解决:Unable to create project from archetype [org.apache.maven.archetypes:maven-archetype-quickstart……
- CF83B:Doctor(二分)
- Python:类的组合
- Rhel yum源配置
- What/How/Why(学习技术三部曲)
- NOIP2016-普及组复赛-第2题-回文日期
- 工作-2017.08.13-周记总结篇(三)
- 安卓文件读写二,对不同文件的处理要点
- 安卓测试和iOS测试的区别
- codeforces 837A
- Unity3D Shader(14)——Fragment Shader(遮挡、透明效果)