#include <delivery.h>
Public Member Functions | |
| Delivery () | |
| Delivery (string id, string name, int gears, int capacity) throw ( invalid_argument ) | |
| void | setID (string id) throw ( invalid_argument ) |
| void | setCapacity (int capacity) throw ( invalid_argument ) |
| int | getCapacity () const |
| virtual void | print (ostream &out=cout) const |
| virtual void | read (istream &in) throw ( invalid_argument ) |
Public Member Functions inherited from Bike | |
| Bike () | |
| Bike (string id, string name, int gears) throw ( invalid_argument ) | |
| void | setID (string id) throw ( invalid_argument ) |
| void | setName (string name) |
| void | setGears (int gears) throw ( invalid_argument ) |
| string | getID () const |
| string | getName () const |
| int | getGears () const |
| virtual | ~Bike () |
Protected Attributes | |
| int | capacity |
Protected Attributes inherited from Bike | |
| string | id |
| string | name |
| int | gears |
Delivery class for storing information about a delivery bike, which has a load capacity.
| Delivery::Delivery | ( | ) |
Default constructor.
| Delivery::Delivery | ( | string | id, |
| string | name, | ||
| int | gears, | ||
| int | capacity | ||
| ) | |||
| throw | ( | invalid_argument | |
| ) | |||
Explicit class constructor initializing a Delivery object using the arguments id, name, gears, and capacity.
| id | a string storing the id of this bike |
| name | a string storing the name of this bike |
| gears | an int storing the gears of this bike |
| capacity | an int storing the capacity of this bike |
| invalid_argument | if an argument is invalid |
| int Delivery::getCapacity | ( | ) | const |
Returns this bike's capacity.
|
virtual |
Prints this delivery bike to the ostream out, which defaults to cout.
| out | an ostream for printing (defaults to cout) |
Reimplemented from Bike.
|
virtual | ||||||||||||||
Reads information for a delivery bike from the istream argument, storing the information in the respective data members.
| in | an istream for reading |
| invalid_argument | if an argument is invalid |
Reimplemented from Bike.
| void Delivery::setCapacity | ( | int | capacity | ) | |
| throw | ( | invalid_argument | |||
| ) | |||||
Sets this bike's capacity, which must be in {1, ..., 120}.
| capacity | an int storing this bike's capacity |
| invalid_argument | if an argument is invalid |
| void Delivery::setID | ( | string | id | ) | |
| throw | ( | invalid_argument | |||
| ) | |||||
Sets this delivery bike's ID, which must have the format D[0-9][0-9].
| id | a string storing this bike's identifier |
| invalid_argument | if an argument is invalid |
Sets this delivery bike's ID.
| id | a string storing this bike's identifier |
| invalid_argument | if an argument is invalid |
|
protected |
1.8.6