-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


| class Song
| 	def initialize(name, artist, duration)
| 		@name = name
| 		@artist = artist
| 		@duration = duration
| 	end
|
| 	def to_s
| 		puts "Song: #{@name}--#{@artist} (#{@duration})"
| 	end
| end

This to_s should RETURN a string, not print one.

Definition should be
def to_s
~  "Song: #{@name}--#{@artist} (#{@duration})"
end

| class KaraokeSong < Song
| 	def initialize(name, artist, duration, lyrics)
| 		super(name, artist, duration)
| 		@lyrics = lyrics
| 	end
|
| 	def to_s
| 		super + " [#{@lyrics}]"
| 	end

Now this will be the return from super (a string) plus a string,
which is what you want.  Before, super returned nil

| end
| aSong = KaraokeSong.new("KSongName", "KSongArtist", 225, "Klyrics")
| aSong.to_s
|
| The error is:
| Song: KSongName--KSongArtist (225)
| song.rbw:33:in `to_s': undefined method `+' for nil:NilClass
| (NoMethodError)
| 	from song.rbw:37
|
| Please help!
|
| Thanks in advance
|
|
|


- --
Derek Wyatt - C++ / Ruby / Unix Programmer
http://rails.derekwyatt.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFDB2+uwwHFeC88e2IRAuzUAJ9c//AWgkUtaA8hdsePOe5EVCd8fgCfco0h
XyGqIEeJT/ra2yUJopt+XsE=
=jsLB
-----END PGP SIGNATURE-----