0

I have a function

getText();

it works this way

getText("This is a really nice text");

but it does not work this way

std:string myString = "Also a nice text";
getText(myString);

Why?

3
  • 3
    you didn't say how is getText declared, I guess it is void getText(const char*) Commented Nov 26, 2014 at 9:33
  • 3
    "I have a function getText();" - that's not a function. that's a function call. where's your function? or at least, the signature... Commented Nov 26, 2014 at 9:34
  • Maybe just a typo, but the namespace separator is :: not : Commented Nov 26, 2014 at 9:41

1 Answer 1

1

I think your function declaration may be like this => " getText(char *parameter)"

if your function declaration is like this => " getText(std::string parameter) "

it should be working

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.