class Monkey2 < Monkey def method2 puts "This is method2" end alias output method2 end monkey = Monkey2.new monkey.method2 monkey.output
module Helper def help puts "Help..." end def method1 puts "helper method1..." end end class Monkey include Helper def method1 puts "monkey method1..." end end monkey = Monkey.new monkey.help monkey.method1#因为重名,当前类的方法优先
class Monkey def method1 puts "This is method1" end end class Monkey2 < Monkey def method2 puts "This is method2" end end monkey = Monkey2.new monkey.method1 monkey.method2 class Monkey2 undef method1 undef method2 end monkey.method1 monkey.method2
class Monkey2 remove_method :method1 undef_method :method2 nd
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有