Hi,
I got this error while trying to access the method that I've posted here.
Main program:
cin>>sname;
string x;
Sports x = Sports.getName();//error:a nonstatic member reference must be relative to a specific object.
loc=x.find(sname);
In Sports.cpp:
string Sports::getName() {return name;}
I've declared getName() function as public.Still I'm getting this error. How to access string from getName() method.
Thanks for any help.