call parent constructor in ruby
Posted
by Stas
on Stack Overflow
See other posts from Stack Overflow
or by Stas
Published on 2010-04-26T18:59:03Z
Indexed on
2010/04/26
19:03 UTC
Read the original article
Hit count: 513
Hi! How can I call parents constructor ?
module C
attr_accessor :c, :cc
def initialization c, cc
@c, @cc = c, cc
end
end
class B
attr_accessor :b, :bb
def initialization b, bb
@b, @bb = b, bb
end
end
class A < B
include C
attr_accessor :a, :aa
def initialization (a, b, c, aa, bb, cc)
#call B::initialization - ?
#call C::initialization - ?
@a, @aa = a, aa
end
end
Thanks.
© Stack Overflow or respective owner