class A{
private:
string a;
public:
A():a("hello world"){};
A(const string & arg):a(arg){};
void put()const{cout<<a;};
};
A aaa();
A bbb;那么A aaa();和A bbb;之间的区别是aaa是一个函数吗?
发布于 2012-02-24 11:09:04
是的,第一个被解释为函数声明。它被称为Most Vexing Parse。
https://stackoverflow.com/questions/9424793
复制相似问题