Hi all,
I am new bird using Ruby, I just occur the problem "uninitiali zed constant Object::Person (NameError)"
can any experts help me?
my code is
I am new bird using Ruby, I just occur the problem "uninitiali zed constant Object::Person (NameError)"
can any experts help me?
my code is
Code:
class Person def initialize(fname, lname) @fname = fname @lname = lname end def to_s "Person: #@fname #@lname" end end person = Person.new("Yen", "Ta") print person
Code:
class Employee < Person def initialize(fname, lname, position) super(fname,lname) @position = position end def to_s super + ", #@position" end end employee = Employee.new("Augustus","Bondi","CFO") print employee
Comment