41 lines
1004 B
C++

// #pragma once is usually included in header files to make sure they are only loaded once
// it's a simpler version of include guards, which are necessary to prevent conflicts
#pragma once
/*
in case #pragma once is not supported by your compiler you'll need more basic include guards
in this case it would be
#ifndef car_h
#define car_h
...class contents
#endif
*/
// including a necessary library and namespace to work with strings
#include <string>
using namespace std;
// define the class
class car
{
// define the visibility of the following fields and methods
// in this case everything is public since visibility is a topic in future lessons
public:
// define two fields, manufacturer and model
std::string manufacturer;
std::string model;
// define a method that will print out information
void print_info();
};
/*
That completes the header file, as you can see, there are no implementations in here.
That's because they will be added in the car.cpp file.
*/