hi yal'
Can anyone tell me the best way to return char* from a function/class method. All i need to do is return a string of chars when the func/method is called. I have also tried using ... string myClass::myMethod(void)... but no luck there either.
my code looks like this..
in class ..
char* myClass::myMethod(void);
Use:
char* myClass::myMethod(void) // should return char*
{
return (myClass.hostname);
}
in function ..
char* myFunc(void);
Use:
char* myFunc(void)
{
return(myClass.myMethod())
}
when i try the above, i get error like ..
'cannot resolve overloaded function `myMethod' based on conversion to type `const char *'
can anyone tell me where im going wrong, should I try to return a pointer to the string and set the return type as 'int'??? (tried unsuccessfully) or is there another wasy to acheive this?
Any help would be appreciated, thanks guys..
J@yb0t
"Always know what you say, but don't always say what you know!"
Can anyone tell me the best way to return char* from a function/class method. All i need to do is return a string of chars when the func/method is called. I have also tried using ... string myClass::myMethod(void)... but no luck there either.
my code looks like this..
in class ..
char* myClass::myMethod(void);
Use:
char* myClass::myMethod(void) // should return char*
{
return (myClass.hostname);
}
in function ..
char* myFunc(void);
Use:
char* myFunc(void)
{
return(myClass.myMethod())
}
when i try the above, i get error like ..
'cannot resolve overloaded function `myMethod' based on conversion to type `const char *'
can anyone tell me where im going wrong, should I try to return a pointer to the string and set the return type as 'int'??? (tried unsuccessfully) or is there another wasy to acheive this?
Any help would be appreciated, thanks guys..
J@yb0t
"Always know what you say, but don't always say what you know!"