-3

你好,我是 C++ 新手,

我正在尝试在字符串上使用共享指针。

class Test{
private:
void test(std::string* str);
boost::shared_ptr<std::string> sample;
};

void Test::test(std::string* str) {

 sample.reset(str); //This is not working.
}

谁能告诉我出了什么问题?

4

1 回答 1

2

首先你声明

void test();

然后你实现

void Test::test(std::string* str) {

这不应该工作

于 2013-05-08T07:52:27.090 回答