previous | start | next

## Example: Printing an Invoice (Class and Function Comments)

- Now design class headers and supply documentation for member functions.
- For member functions you will have to come up with reasonable parameters and return types.

  >     /**
  >        Describes an invoice for a set of purchased products.
  >     */
  >     class Invoice
  >     {
  >     public:
  >        /**
  >           Adds a charge for a product to this invoice.
  >           @param aProduct the product that the customer ordered
  >           @param quantity the quantity of the product
  >        */
  >        void add(Product p, int qunatity);
  >        /**
  >           Prints the invoice.
  >        */
  >        void print() const;
  >     };

  >     /**
  >        Describes a quantity to an article to purchase and its price
  >     */
  >     class Item
  >     {

  >     public:
  >        /**
  >           Computes the total cost of this item
  >           @return the total price
  >        */
  >        double get_total_price() const;

  >        /**
  >           Prints this item
  >        */
  >        void print() const;
  >      };

  >     // etc.

previous | start | next