The difference between A aaa; and A aaa ();

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; 

So what is the difference between A aaa(); and A bbb; Is aaa like a function?

+6
source share
1 answer

Yes, the first is interpreted as a function declaration. It was named Most Vexing Parse .

+11
source

Source: https://habr.com/ru/post/909244/


All Articles