Basket Class Reference

The class Basket represents the basket of the customer who wants to buy one or more products: it's intended to be used by User class only. More...

#include <Basket.h>

Inheritance diagram for Basket:
Inheritance graph
[legend]
Collaboration diagram for Basket:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Basket ()
void addProduct (Product *p, int aQty=1)
void addProduct (ProductProxy *p, int aQty=1)
 Add a product to the basket.
float total () const
 Return the total cost of the basket.
void empty ()
void removeProduct (Product *p, int aQty=1)

Private Attributes

float _tot

Friends

std::ostream & operator<< (std::ostream &, Basket &)

Detailed Description

The class Basket represents the basket of the customer who wants to buy one or more products: it's intended to be used by User class only.


Constructor & Destructor Documentation

Basket::Basket (  ) 

References _tot.


Member Function Documentation

void Basket::addProduct ( ProductProxy p,
int  aQty = 1 
)

Add a product to the basket.

It's possibile to specify how many pieces of the same product.

Parameters:
[in] p An instance to ProductProxy
[in] aQty How many pieces of the same product (default is 1)

References _tot, ProductProxy::getPrice(), and ProductProxy::uniqueID().

void Basket::addProduct ( Product p,
int  aQty = 1 
)
void Basket::empty (  ) 

References _tot.

void Basket::removeProduct ( Product p,
int  aQty = 1 
)
float Basket::total (  )  const

Return the total cost of the basket.

Returns:
The total, expressed as float

References _tot.

Referenced by Order::create().


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  aStream,
Basket p 
) [friend]

Member Data Documentation

float Basket::_tot [private]

Referenced by addProduct(), Basket(), empty(), and total().


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2