2020-03-28 14:45:55 +01:00
|
|
|
#include "car.h"
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
int main() {
|
2020-03-28 19:49:57 +01:00
|
|
|
// create a new car and store it in the variable 'a'
|
2020-04-01 15:29:10 +02:00
|
|
|
// in contrast to java, c++ does not need initialization with the 'new' keyword here.
|
2020-04-01 14:13:55 +02:00
|
|
|
car a;
|
2020-03-28 19:49:57 +01:00
|
|
|
// set some data for that car
|
2020-03-28 14:45:55 +01:00
|
|
|
a.manufacturer = "Benz";
|
|
|
|
a.model = "Velo";
|
2020-04-01 14:13:55 +02:00
|
|
|
|
2020-03-28 19:49:57 +01:00
|
|
|
// do the same for a second car
|
2020-03-28 14:45:55 +01:00
|
|
|
car b;
|
|
|
|
b.manufacturer = "Ford";
|
|
|
|
b.model = "Model T";
|
|
|
|
|
2020-03-28 19:49:57 +01:00
|
|
|
// use a function of the car class to print out the information
|
2020-03-28 14:45:55 +01:00
|
|
|
a.print_info();
|
|
|
|
b.print_info();
|
|
|
|
}
|