-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvehicle.h
55 lines (44 loc) · 1.48 KB
/
vehicle.h
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
49
50
51
52
53
54
55
#ifndef VEHICLE_H
#define VEHICLE_H
#pragma once
class Vehicle {
protected:
std::string brand = "";
std::string model = "";
int productionYear = 0;
std::string registrationNumber = "";
int horsePower = 0;
std::string fuelType = "";
std::string gearboxType = "";
std::string driveType = "";
int fuelConsumption = 0;
public:
// default constructor
Vehicle();
virtual ~Vehicle();
Vehicle(const Vehicle& other);
// constructor
Vehicle(std::string brand, std::string model, int productionYear, std::string registrationNumber,
int horsePower, std::string fuelType, std::string gearboxType,
std::string driveType, int fuelConsumption);
virtual void displayData() const = 0;
// Virtual functions for the derived classes
// Car
virtual int getTrunkCapacity() const { return 0; }
virtual int getSeatNumber() const { return 0; }
virtual std::string getBodyType() const { return ""; }
virtual void setTrunkCapacity(int trunkCapacity) {}
virtual void setSeatNumber(int seatNumber) {}
virtual void setBodyType(std::string bodyType) {}
// Motorcycle
virtual int getEngineSize() const { return 0; }
virtual int getTopSpeed() const { return 0; }
virtual std::string getType() const { return ""; }
virtual std::string getBrakeType() const { return ""; }
virtual void setEngineSize(int engineSize) {}
virtual void setTopSpeed(int topSpeed) {}
virtual void setType(std::string type) {}
virtual void setBrakeType(std::string brakeType) {}
friend class Listing;
};
#endif // VEHICLE_H