-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMotor.cpp
More file actions
46 lines (43 loc) · 969 Bytes
/
Motor.cpp
File metadata and controls
46 lines (43 loc) · 969 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
using std::cout;
using std::endl;
#include "Motor.h"
#include "Vehicle.h"
//constructor
Motor::Motor( const int identity, const int theyear, const string& colorful, const int miles, const int eng, const int fro, const int bac)
: Vehicle(identity, theyear, colorful, miles)
{
//setting new things only for motor
engine = eng;
front = fro;
back = bac;
}
// returns engine size
int Motor::getengine() const
{
return engine;
}
// returns front wheel size
int Motor::getfront() const
{
return front;
}
// returns back wheel size
int Motor::getback() const
{
return back;
}
// virtual print
void Motor::print() const
{
cout << "{{{printing motor}}}" << endl;
cout << "Engine: "<< getengine() <<endl;
cout << "Front: " << getfront() << endl;
cout << "Back: " << getback() << endl;
Vehicle::print();
}
//operator overloading
ostream &operator<<( ostream &output, const Motor &c)
{
c.print();
}