In the code snippet how is 10 getting assigned to x ? There is no definition for copy constructor, so the default one is being used.
class X
{
public:
int x;
};
int main()
{
X a = {10};
X b = a;
cout << a.x << " " << b.x;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire