编译器在其他错误中指出了字符串(强调)。我使用过 shared_ptr s'错误?编译器是否能够以非显式方式设置值来进入私有?
#pragma once //(i've tried also without this)
#include <memory>
class Stack
{
private:
shared_ptr<int> n; // this string
public:
Stack();
};
//#include's
using namespace std;
Stack::Stack()
{
shared_ptr<int> n_user(new int);
cin >> *n_user;
shared_ptr<int> n(new int);
this->n = n_user;
}
答案 0 :(得分:3)
您的头文件需要如下所示:
#pragma once
#include <memory> // ADDED
class Stack
{
private:
std::shared_ptr<int> n; // ADDED std::
int *s_array;
std::shared_ptr<int> amount; // ADDED std::
public:
Stack();
void Push(int value);
int Get(int receiver);
~Stack();
};