------ art_22161_30129289.1162565255502 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 11/3/06, Jan Svitok <jan.svitok / gmail.com> wrote: > > > Thanks. This is a much better code. One more related thing that confuses > me > > is that I thought all instance variables of a class are private to the > > class. Then are the private instance variables inherited by a sub-class? > If > > yes, then in my Savings class withdraw method, can I write @balance -> amt > > instead of self.balance - mt ? > > sure. the difference is whether you're getting the var from the inside > (@balance) or outside (self.balance) > > @balance will be a tiny bit faster, self.balance is more flexible as > you can change the inner implementation later without breaking other > things (i.e. you can add conditions checking befor the var is actually > set) > > Coming from a Java background the confusion still exists. I still can't fathom the difference between @balance and self.balance as mentioned by you (Jan Svitok) above. Does not the self.balance mean the instance variable balance of current object? And is not @balance the same thing? ------ art_22161_30129289.1162565255502--