Saturday 31 August 2013

C++ error C2228

C++ error C2228

I'll admit I'm not sure of what I'm doing here, so I am doing a lot of
copying sample code from my textbook and replacing with info for my own
program... but can tell me what is causing this error?
Car.cpp
// Implementation file for the Car class
#include "Car.h"
// This constructor accepts arguments for the car's year
// and make. The speed member variable is assigned 0.
Car::Car(int carYearModel, string carMake)
{
yearModel = carYearModel;
make = carMake;
speed = 0;
}
Car.h
// Specification file for the Car class
#ifndef CAR_H
#define CAR_H
#include <string>
using namespace std;
class Car
{
private:
int yearModel; // Car year model
string make; // Car make
int speed; // Car speed
public:
Car(int, string); // Constructor
};

No comments:

Post a Comment