From: Serban Udrea Date: 2001-07-10T11:00:23+09:00 Subject: [ruby-talk:17581] perfect newbie Hello everybody, I'm a total newbie to OOP and Ruby. Actually I want to learn how to do OOP and choose Ruby because I read that it's a nice OOP programming language and it's also good for beginners like me. I have for the moment a problem with the "class instance variables". There is the folowing written in the FAQ: "There is no way to access class instance variables from instance methods." Why is the next piece of code returning "My Way" to stdout? The code is just a slight modification of Example 1 from the article: Programming in Ruby by Dave Thomas and Andy Hunt class Song def initialize(title) @title = title end def to_s p @title end end aSong = Song.new("My Way") aSong.to_s Regards, Serban Udrea -- #<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><># # "Human beings, like all other life forms, are parts of an inseparable # # organic whole. Their intelligence, therefore, implies that, the whole too # # is intelligent" # #<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><># Serban Udrea S.Udrea@gsi.de GSI - Plasma Physics Department Darmstadt, Germany