Z
Zengqh Mansion
very simple program:
class Song
def initialize(duration)
@duration =3D duration
end
def duration=3D(new_duration)
@duration =3D new_duration
end
end
song =3D Song.new(260)
print song.duration
the compiler outputs=EF=BC=9A
D:/=E6=88=91=E7=9A=84=E6=96=87=E6=A1=A3/Ruby/attr_writer.rb:12:in `<main>=
': undefined method `duration'
for
#<Song:0xb33f10 @duration=3D260> (NoMethodError)=E3=80=82
appreciate for your help.
-- =
Posted via http://www.ruby-forum.com/.=
class Song
def initialize(duration)
@duration =3D duration
end
def duration=3D(new_duration)
@duration =3D new_duration
end
end
song =3D Song.new(260)
print song.duration
the compiler outputs=EF=BC=9A
D:/=E6=88=91=E7=9A=84=E6=96=87=E6=A1=A3/Ruby/attr_writer.rb:12:in `<main>=
': undefined method `duration'
for
#<Song:0xb33f10 @duration=3D260> (NoMethodError)=E3=80=82
appreciate for your help.
-- =
Posted via http://www.ruby-forum.com/.=