1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Classes and objects

  1. Mar 28, 2009 #1
    1. The problem statement, all variables and given/known data

    Create a class that adds counts of letters or two Strings, and create an object which represents sum of the counts.

    2. Relevant equations


    3. The attempt at a solution

    i am confused about how to construct objects in a class itself, and not in client code.
    as in this site,


    adding the roll produced by dice is done by client, but not by the class.

    further, if objects are instances of the class, then the client must call the class and add whatever it returns or whatever from the methods.

    but how can a class do this?

    i am instructed to "Constructs and returns a new LetterInventory object that represents the sum of this letter inventory and the other given LetterInventory. The counts for each letter should be added together. The two LetterInventory objects being added together (this and other) should not be changed by this method"
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted