I try to overload constructor with int
and char *
. Then there is ambiguity in call with 0
. Is there any workaround/solution for this?
CBigInt (unsigned int);
CBigInt (const char *);
The problem is on the line with 0
:
CBigInt a;
// some more code
a *= 0;
Thanks for answering.
Make one of the constructors explicit. It will then only be used when passed type exactly matches.
CBigInt (unsigned int);
explicit CBigInt (const char *);
You could use the "explicit" keyword:
explicit CBigInt(const char *);
Using this, you must explicitly cast the argument to a const char *, otherwise CBigInt(unsigned) will be executed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With