On Sat, Dec 10, 2011 at 10:47 PM, Darren H. <dhulem1 / umbc.edu> wrote:

> Hi all,
>
> I am currently stuck trying to call a method from a different class.
>
> example...
>
> I have a checkout class and within it I have the overall method, I want
> to call the overall method from within the shopping class...
>

So that could be done like this.

<code>
# caveat : untested code
class Checkout

  def overall_instance_method
    "overall total on instance"
  end

  def class.overall_class_method
    "overall total on class"
  end

end

class Shopping

  def order
    # prepare order

    # with a Checkout instance
    checkout = Checkout.new
    puts checkout.overall_instance_method

    # with class method on Checkout
    puts Checkout.overall_class_method
  end

end
</code>

HTH,

Peter