hey folks,

class methods are defined with `self.foo` rather than `class.foo` - so
that

  def class.overall_class_method
    "overall total on class"
  end

should be written:

  def self.overall_class_method
    "overall total on class"
  end


  Peter's example nicely demonstrates two ways of calling a method
defined in one class from another - either creating an instance of the
first class within the second and then calling the instance method on
it, or by defining the method in the first class as a class method,
rather than an instance method - allowing you to call it directly
without creating an instance of the first class.

  if you make the change noted above, and add...

  s = Shopping.new
  s.order

  ...to the end, you'll see the expected output.

  - j

-- 
Posted via http://www.ruby-forum.com/.