I defined class A
class A{
public:
A(int){}
private:
A(const A&);
A& operator=(const A&);
};
I thought that since I give the constructor from int, implicit construction is provided ... Anyway, for now
A myA(7);
works fine, g ++ gives me this line:
A myA = 7;
following error:
Test02.cpp: In function ‘int main(int, char**)’:
Test02.cpp:5:3: error: ‘A::A(const A&)’ is private
Test02.cpp:12:12: error: within this context
Another compiler likes this conversion. Where is the truth? How should I define A to get A myA = 7; work?
source
share