Не работает тип string в классе
Что нужно добавить или поменять?
#pragma once
#include <iostream>
class point {
private:
double x1, y1;
public:
friend class circle;
};
class circle {
private:
point x;
double r;
string color;
public:
circle() {
x.x1 = 0;
x.y1 = 0;
r = 0;
color = "black";
}
circle(double x1, double y1, double r) {
this->x.x1 = x1;
this->x.y1 = y1;
this->r = r;
}
};
Ответы (1 шт):
Автор решения: Harry
→ Ссылка
Добавить к
#include <iostream>
две строки:
#include <string>
using namespace std;
Можно без последней, но тогда использовать не string, а std::string.
