2020-05-10 16:07:27 +02:00

24 lines
687 B
C++

// include the header file
#include "car.h"
// include necessary libraries and namespaces
#include <iostream>
#include <string>
using namespace std;
// define the implementation for car.print_info()
void car::print_info()
{
cout << "Car Information:" << endl;
// fields that are defined in the header file can just be used like normal variables here
cout << "- manufacturer: " << manufacturer << endl;
cout << "- model: " << model << endl;
}
car::car(string manufacturer, string model) {
// set manufacturer of the current object to the given manufacturer
this->manufacturer = manufacturer;
// set model of the current object to the given model
this->model = model;
}