class Box
def initialize(w,h)
@width,@height=w,h
end
def getArea
@height*@width
end
end
class BigBox <Box
def printArea
@area=@width*@height
puts "#@area"
end
def getArea
puts "bigbox 的面积是 #@area "
end
end
box =BigBox.new(,)
box.printArea//只有加上这个,area才有值
box.getArea

最新文章

  1. [CentOS Server] Bug when calling matlab in bash
  2. asp.net各种cookie代码和解析
  3. js判断手机访问PC端跳转到手机站
  4. Linux下安装vsftpd
  5. 【转】web测试总结
  6. JS函数和变量
  7. c++ 动态分配二维数组 new 二维数组
  8. 使用Redis的理由
  9. sublime2开发Python的编码问题
  10. 定制Attribute
  11. as3 公式
  12. WAMP环境 apache 2.4.23 局域网访问
  13. Rolling Hash(Rabin-Karp算法)匹配字符串
  14. C#常用工具类——Excel操作类(ZT)
  15. idea jsp html 空白页的问题
  16. onsubmit ajax return false 无效
  17. Linux中断(interrupt)子系统之三:中断流控处理层【转】
  18. IAR EWARM 关闭纯汇编函数的警告的方法
  19. Mac OS X 下多个JDK版本的切换小技巧
  20. Element ui 中使用table组件实现分页记忆选中

热门文章

  1. Leveldb源码分析--3
  2. RD Client、TeamViewer连接主机
  3. Codeforces 475D 题解(二分查找+ST表)
  4. Redis的持久化存储
  5. Smarty模板引擎模板文件.tpl和.html的区别
  6. 【知识强化】第二章 数据的表示和运算 2.4 算术逻辑单元ALU
  7. JSP学习(3)
  8. This page includes a password or credit card input in a non-secure context. A warning has been added
  9. Jenkins构建触发器(定时构建项目)
  10. 前端 js javascript