class Person
def initialize(name)
@name = name
end
end
class Employee < Person
end
emp = Employee.new # throws error wrong number of arguments
emp = Employee.new("foo") # parent class initialize method is called
class Employee < Person
def initialize(name, designation)
super(name)
@designation = designation
end
end
emp = Employee.new("foo", "bar")
Posted by Sandheep to Sandheep's deck (2013-05-22 09:01)