remove duplicate code

This commit is contained in:
2020-05-04 19:34:12 +02:00
parent c6246aade2
commit d30589c5ad
19 changed files with 12 additions and 280 deletions

View File

@ -8,4 +8,4 @@ to be initialized with the keyword 'new'.
Relevant Files:
- [main.cpp](./main.cpp)
- [main.cpp](./classes/main.cpp)

View File

@ -1,20 +0,0 @@
/*
Basic Car class
just here to make the demonstration in the main file possible
explanation of the code here will be given in later lessons
*/
#include "car.h"
#include <iostream>
#include <string>
using namespace std;
void car::print_info()
{
cout << "Car Information:" << endl;
cout << "- manufacturer: " << manufacturer << endl;
cout << "- model: " << model << endl;
}

View File

@ -1,20 +0,0 @@
/*
Basic Car class
just here to make the demonstration in the main file possible
explanation of the code here will be given in later lessons
*/
#pragma once
#include <string>
using namespace std;
class car
{
public:
std::string manufacturer;
std::string model;
void print_info();
};

View File

@ -1,20 +0,0 @@
#include "car.h"
#include <cstring>
int main() {
// create a new car and store it in the variable 'a'
// in contrast to java, c++ does not need initialization with the 'new' keyword here.
car a;
// set some data for that car
a.manufacturer = "Benz";
a.model = "Velo";
// do the same for a second car
car b;
b.manufacturer = "Ford";
b.model = "Model T";
// use a function of the car class to print out the information
a.print_info();
b.print_info();
}