Skip to content

Commit 4f6c88c

Browse files
committed
Base Vehicle class created
0 parents  commit 4f6c88c

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

Vehicle.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//
2+
// Created by Esteban Parra on 9/5/19.
3+
//
4+

Vehicle.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// Created by Esteban Parra on 9/5/19.
3+
//
4+
5+
#ifndef DRIVINGSIMULATOR_VEHICLE_H
6+
#define DRIVINGSIMULATOR_VEHICLE_H
7+
8+
#include <string> // std::string, std::stoi
9+
10+
using namespace std;
11+
12+
class Vehicle {
13+
14+
private :
15+
string myBrand, myModel;
16+
17+
public:
18+
Vehicle(string brand = "unknown", string model = "unknown") {
19+
setBrand(brand);
20+
setModel(model);
21+
}
22+
23+
string getBrand() {
24+
return myBrand;
25+
}
26+
27+
void setBrand(string brand) {
28+
myBrand = brand;
29+
}
30+
31+
string getModel() {
32+
return myModel;
33+
}
34+
35+
void setModel(string model) {
36+
myModel = model;
37+
}
38+
39+
string toString() {
40+
return getBrand() + " " + getModel();
41+
}
42+
};
43+
44+
45+
#endif //DRIVINGSIMULATOR_VEHICLE_H

main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <iostream>
2+
3+
int main() {
4+
std::cout << "Hello, World!" << std::endl;
5+
return 0;
6+
}

0 commit comments

Comments
 (0)