#include <bike.h>
Public Member Functions | |
| 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 void | print (ostream &out=cout) const |
| virtual void | read (istream &in) throw ( invalid_argument ) |
| virtual | ~Bike () |
Protected Attributes | |
| string | id |
| string | name |
| int | gears |
Bike class for storing information about a bike, which has an identifier, a name, and a number of gears.
| Bike::Bike | ( | ) |
Default constructor.
| Bike::Bike | ( | string | id, |
| string | name, | ||
| int | gears | ||
| ) | |||
| throw | ( | invalid_argument | |
| ) | |||
Explicit class constructor initializing a bike object using the arguments id, name, and number of gears.
| id | a string storing the identifier of this bike |
| name | a string storing the name of this bike |
| gears | an int storing the number of gears of this bike |
| invalid_argument | if an argument is invalid |
|
virtual |
Destructor. Does nothing but is recommended for classes with virtual methods.
| int Bike::getGears | ( | ) | const |
Returns this bike's gears.
| string Bike::getID | ( | ) | const |
Returns this bike's ID.
| string Bike::getName | ( | ) | const |
Returns this bike's name.
|
virtual |
|
virtual | ||||||||||||||
| void Bike::setGears | ( | int | gears | ) | |
| throw | ( | invalid_argument | |||
| ) | |||||
Sets this bike's gears, which must be in {1, ..., 24}.
| gears | an int storing this bike's gears |
| invalid_argument | if the number of gears is invalid |
| void Bike::setID | ( | string | id | ) | |
| throw | ( | invalid_argument | |||
| ) | |||||
Sets this bike's ID, which must have the format [A-Z][0-9][0-9].
| id | a string storing this bike's identifier |
| invalid_argument | if an argument is invalid |
| void Bike::setName | ( | string | name | ) |
Sets this bike's name.
| name | a string storing this bike's name |
|
protected |
|
protected |
|
protected |
1.8.6