When I run the following code it shows me
|24|error: no matching function for call to ‘info::show()’|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#include<iostream>
#include<string>
using namespace std;
class info
{
private:
string fname = "Prog";
string lname = " Geek";
public:
void show(string fname, string lname)
{
cout<<fname;
cout<<lname;
}
};
int main ()
{
info me;
me.show();
return 0;
}
|
Why?
Last edited on
Info has void show(string, string)
You call void show()
but when i write me.show(string fname, string lname);
it shows |24|error: expected primary-expression before ‘fname’|
or when i write me.show(fname, lname);
it shows |24|error: ‘fname’ was not declared in this scope|
what i exactly have to do?
Last edited on