A
Andrea Dallera
Hi everybody,
given the following situation:
class Parent
def initialize
print "magic\n"
end
end
class Child < Parent
def initialize
print "more magic\n"
end
end
child = Child.new
is there a way in which i can get "magic" and "more magic" as the
output, without having to add super to the child class's constructor? I
was thinking about overriding the class method "new" but i really didn't
get anything to work up to now.
Any suggestions? Thanks in advance!
given the following situation:
class Parent
def initialize
print "magic\n"
end
end
class Child < Parent
def initialize
print "more magic\n"
end
end
child = Child.new
is there a way in which i can get "magic" and "more magic" as the
output, without having to add super to the child class's constructor? I
was thinking about overriding the class method "new" but i really didn't
get anything to work up to now.
Any suggestions? Thanks in advance!