Your code's got three immediate problems.
The first one (and the one the compiler's having a whine about) is that it can't work out which constructor you want called. When you give it an
int
it can work out you want the first called. However when you give it a
const char *
it has no idea that you want the
string
constructor called. So if you want the string constructor called actually give it a
string
!
Mint b{ std::string{ "1234567" } };
is the sort of thing you need to use if you've got a modern compiler
Mint b( std::string( "1234567" ) );
if you haven't.
Second problem is how you're storing your digits. A better way than using a built in array is to use a
std::vector
. It's dynamically resizable and, once sized, is usually as fast as a built in array.
The final problem is handling copying and assignment of your objects. Consider what happens when you do things like:
Mint a = 137;<br />
Mint b = a;<br />
Hopefully if you use a
vector
to store your digits this problem solves itself but if you try and manage memory yourself then it's something you should consider.