-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBus.cpp
More file actions
30 lines (28 loc) · 657 Bytes
/
Copy pathBus.cpp
File metadata and controls
30 lines (28 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
using std::cout;
using std::endl;
#include "Bus.h"
//constructor
Bus::Bus( const int identity, const int theyear, const string& colorful, const int miles, const int pas)
: Vehicle(identity, theyear, colorful, miles)
{
//sets passenger capacity
passenger = pas;
}
// returns passenger capacity
int Bus::getpassenger() const
{
return passenger;
}
// print overloading
void Bus::print() const
{
cout << "{{{printing bus}}}" << endl;
cout << "Passenger capacity: "<< getpassenger() <<endl;
Vehicle::print();
}
//operator overloading
ostream &operator<<( ostream &output, const Bus &c)
{
c.print();
}