R
REH
Can some tell me why the chooses the constructor in class B over operator B
in class A? Is this not ambiguous?
Thanks.
#include <iostream>
using namespace std;
struct A;
struct B {
B() {}
B(const A&) {} // this is choosen
};
struct A {
A() {}
operator B() const {return B();} // this is not
};
int main()
{
A a;
B b;
b = a; // ambiguous?
}
in class A? Is this not ambiguous?
Thanks.
#include <iostream>
using namespace std;
struct A;
struct B {
B() {}
B(const A&) {} // this is choosen
};
struct A {
A() {}
operator B() const {return B();} // this is not
};
int main()
{
A a;
B b;
b = a; // ambiguous?
}