ruby的实例变量
2024-09-05 22:25:20
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
最新文章
- [CentOS Server] Bug when calling matlab in bash
- asp.net各种cookie代码和解析
- js判断手机访问PC端跳转到手机站
- Linux下安装vsftpd
- 【转】web测试总结
- JS函数和变量
- c++ 动态分配二维数组 new 二维数组
- 使用Redis的理由
- sublime2开发Python的编码问题
- 定制Attribute
- as3 公式
- WAMP环境 apache 2.4.23 局域网访问
- Rolling Hash(Rabin-Karp算法)匹配字符串
- C#常用工具类——Excel操作类(ZT)
- idea jsp html 空白页的问题
- onsubmit ajax return false 无效
- Linux中断(interrupt)子系统之三:中断流控处理层【转】
- IAR EWARM 关闭纯汇编函数的警告的方法
- Mac OS X 下多个JDK版本的切换小技巧
- Element ui 中使用table组件实现分页记忆选中
热门文章
- Leveldb源码分析--3
- RD Client、TeamViewer连接主机
- Codeforces 475D 题解(二分查找+ST表)
- Redis的持久化存储
- Smarty模板引擎模板文件.tpl和.html的区别
- 【知识强化】第二章 数据的表示和运算 2.4 算术逻辑单元ALU
- JSP学习(3)
- This page includes a password or credit card input in a non-secure context. A warning has been added
- Jenkins构建触发器(定时构建项目)
- 前端 js javascript