self
class Foo def initialize(x) self.c x end def c(x) puts "c的参数是#{x}" end end f = Foo.new(1)self == @ !self.eql?(@)this && @
Last updated
class Foo
def initialize(x)
self.c x
end
def c(x)
puts "c的参数是#{x}"
end
end
f = Foo.new(1)self == @
!self.eql?(@)this && @Last updated
再比如
```ruby
class A
@num = 8
def show
puts @num
end
end
class B < A
def initialize
@num = 3
end
end
b = B.new
b.show