我在初始化嵌套类构造函数时遇到问题。如何在C++中初始化嵌套类的构造函数
这里是我的代码:
#include <iostream>
using namespace std;
class a
{
public:
class b
{
public:
b(char str[45])
{
cout<<str;
}
}title;
}document;
int main()
{
document.title("Hello World"); //Error in this line
return 0;
}
我得到的错误是:
fun.cpp:21:30: error: no match for call to '(a::b)'
什么是错误讯息? – 2012-02-06 12:43:13
@OliCharlesworth fun.cpp:21:30:错误:不匹配呼叫'(a :: b)' – sandbox 2012-02-06 12:46:49