#include <iostream>
using namespace std;
int dig()
{
return 5;
}
int num2()
{
return 9;
}
int num_get()
{
return dig()+num2();
}
int main()
{
cout<<num_get();
}
I am just a beginner who was practicing some c++ code.when I was trying to call num_get()
function. The compiler says the following:-
>error: reference to ‘num_get’ is ambiguous
23 | cout<<num_get();
| ^~~~~~~
In file included from /usr/include/c++/9/ios:41,
from /usr/include/c++/9/ostream:38,
from /usr/include/c++/9/iostream:39,
from main.cpp:1:
/usr/include/c++/9/bits/localefwd.h:157:11: note: candidates are: ‘template class
std::num_get’
157 | class num_get;
| ^~~~~~~
main.cpp:16:5: note: ‘int num_get()’
16 | int num_get()
| ^~~~~~~
I was able to resolve the error by changing the value of num_get() to numb_get."What I want to know is simple just tell me what is wrong with num_get() function with clear information." sorry if I was annoying.I searched about the error in internet didn't get relevant info that's why i posted this question.
Thanks for spending your valuable time answering my beginner question hope i will ask some good question next time.