e6.5-3.rb
来自「ruby教材 你可以好好的看 有意识的阿」· RB 代码 · 共 30 行
RB
30 行
#E6.5-3.rb
class Person
def speak
"protected:speak "
end
def laugh
" private:laugh"
end
protected :speak
private :laugh
def useLaugh(another)
puts another.laugh
end
def useSpeak(another)
puts another.speak
end
end
p1=Person.new
p2=Person.new
p2.useSpeak(p1)
#p2.useLaugh(p1)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?