-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMotorVehicle.h
More file actions
49 lines (35 loc) · 1.4 KB
/
MotorVehicle.h
File metadata and controls
49 lines (35 loc) · 1.4 KB
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
47
48
// 12191706 ±èÁ¤Áø
// Chpater 10 - 10.8
// MotorVehicle class definition.
#pragma once
#include <iostream>
#include <string>
// prevent multiple inclusions of header
#ifndef MOTORVEHICLE_H
#define MOTORVEHICLE_H
class MotorVehicle {
friend std::ostream& operator<<(std::ostream&, const MotorVehicle&); // overloaded output operator
public:
explicit MotorVehicle(std::string ,int ,int); // constructor with three data member
void setMake(std::string); // set make function
std::string getMake() const; // get make function
void setFuelType(std::string); // set fuelType function
std::string getFuelType() const; // get fuelType function
void setYearOfManufacture(int); // set yearOfManufacture function
int getYearOfManufacture() const; // get yearOfManufacture function
void setColor(std::string); // set color function
std::string getColor() const; // get color function
void setEngineCapacity(int); // set engineCapacity function
int getEngineCapacity() const; // get engineCapacity function
void displayCarDetails(); // display data members function
bool operator==(const MotorVehicle&) const; // equaility operator
bool operator!=(const MotorVehicle&) const; // inequaility operator
bool operator>(const MotorVehicle&) const; // greater than operator
private:
std::string make;
std::string fuelType;
int yearOfManufacture;
std::string color;
int engineCapacity;
};
#endif // !MOTORVEHICLE_H