构造函数私有化

在我使用std::make_unique<Typename T>()构建一个我自定义的类的时候,不小心将构造函数写成了私有的,出现了这个问题-cannot access private member declared in class,这完全是由于不仔细造成的...

cannot access private member declared in class

可能的错误原因:

1
2
3
4
5
6
7
8
9
10
11
class TestA
{
TestA()
{

}
~TestA()
{

}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
class TestA
{
private / protected:
TestA()
{

}
~TestA()
{

}
}