Dzielę program na pliki .h i .cpp i napotkałem pewien problem z kompilacją. Mianowicie wyskakuje błąd "nieznany specyfikator przesłonięcia" przy zmiennych string. Gdy je usunę z klasy i metod program się kompiluje. Ktoś wie co może być przyczyną ?
.h
#pragma once
class Person
{
public:
int price;
string name;
string surrname;
int height = 0;
int ratingOfThePerson = 0;
virtual void addPerson();
virtual void showPerson();
};
.cpp
#include "Person.h"
#include <iostream>
using namespace std;
void Person::addPerson()
{
cout << "What's the price?: "; cin >> this->price;
cout << "What's the name?: "; cin >> this->name;
cout << "What's the surrname?: "; cin >> this->surrname;
cout << "Height?: "; cin >> this->height;
cout << "What's the rating of the person?(1-10): "; cin >> this->ratingOfThePerson;
}
void Person:: showPerson()
{
cout << "Price: " << this->price << endl;
cout << "Name: " << this->name << endl;
cout << "Surrname: " << this->surrname << endl;
cout << "Height: " << this->height << endl;
cout << "Rating: " << this->ratingOfThePerson << endl;
}