Nick Massaro is out of the office untill July 15.

>>> ruby-talk 07/06/02 12:08 >>>

so i have a question realted to class inheritence: when a class inherits
from a superclass, is it good coding practice for the superclass to use
the childs instance variables? or should they be passed? for example:

TO PASS:

class A
  def initialize(x)
    puts x
  end
end

class B < A
  def initialize
    @x = "hello world!"
    super(@x)
  end
end

OR TO BE:

class A
  def initialize
    puts @x
  end
end

class B < A
  def initialize
    @x = "hello world!"
    super
  end
end

i don't know why but i tend feel like its cool for the subclass to look
up at the superclass, but not for the superclass to look down. it just
seems funny, but i can place why. so i'm wondering what others think.

~transami

-- 
~transami

"They that can give up essential liberty to obtain a little
 temporary safety deserve neither liberty nor safety."
	-- Benjamin Franklin