J
Jess
Hello,
I can perform implicit conversion through constructor, like
class A{
public:
A(int x):a(x){};
int a;
};
int main(){
A a = 10;
return 0;
}
However, if I have
class A{
public:
A(int x, int y):a(x),b(y){};
int a;
int b;
};
Then the compiler doesn't allow me to convert:
int main(){
A a = (10,20);
return 0;
}
How can I perform implicit conversion through constructor with
multiple arguments?
Many thanks,
Jess
I can perform implicit conversion through constructor, like
class A{
public:
A(int x):a(x){};
int a;
};
int main(){
A a = 10;
return 0;
}
However, if I have
class A{
public:
A(int x, int y):a(x),b(y){};
int a;
int b;
};
Then the compiler doesn't allow me to convert:
int main(){
A a = (10,20);
return 0;
}
How can I perform implicit conversion through constructor with
multiple arguments?
Many thanks,
Jess