First of all, you have missed :
after private
Second, if method (String name)
in the cpp file should be the method (String name)
from your class, it must be:
bool me::method(std::string name)
{
// ...
}
Third, if you want this bool me::method(std::string name)
to be different function, a global one, not from you class, it must be:
ret_type method(std::string name)
{
// ...
}
And, fourth,
cout<<"name"<<endl;
will pring the string (literal) "name". If you want to print the variable name
, use it without the quotes:
std::cout<< name <<endl;
I'd recommend you to get a book
Ah, and this one:
me::me()
{
method(string name); //can i do this? isn't there another alternative?
}
method(string name)
- this is not valid syntax. It should be something like:
me::me()
{
string name;
// do something with name
method( name ); // if "method" is a method, for real
}