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!

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

    n/a

    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,

    http://math.hws.edu/javanotes/c5/s2.html

    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
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

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



Similar Discussions: Classes and objects
  1. Class A amplifier (Replies: 2)

  2. Class AB amplifier (Replies: 19)

  3. Enum class (Replies: 8)

  4. Abstract Class return (Replies: 14)

Loading...