Thread: Parameterized constructors

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Hi,

    Add a totalPrice() function to your Tools class. It will calculate the total inventory price for one Tools object. Calculating the grand total of all the Tools is then a matter of calling the totalPrice() function on each of your Tools objects and adding them up.

  2. #2
    Registered User
    Join Date
    Oct 2005
    Posts
    20
    7stud, thanks for the help. How would I go about adding them up though? I can't use saws.totalPrice() + hammers.totalPrice() + nails.totalPrice() right? Please enlighten a novice.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Copy constructors; Best practices (and private)
    By Mario F. in forum C++ Programming
    Replies: 15
    Last Post: 06-23-2006, 04:42 PM
  2. Arrays and Constructors
    By Verdagon in forum C++ Programming
    Replies: 1
    Last Post: 07-20-2005, 07:20 PM
  3. constructors, arrays, and new
    By Thantos in forum C++ Programming
    Replies: 6
    Last Post: 05-30-2004, 06:21 PM
  4. Copy constructors and private constructors
    By Eibro in forum C++ Programming
    Replies: 5
    Last Post: 11-24-2002, 10:16 AM
  5. Default Constructors
    By MethodMan in forum C++ Programming
    Replies: 2
    Last Post: 10-25-2002, 06:30 PM