+ 2
Printing a string from a class
can I print a string from a void function in a class? https://code.sololearn.com/cF6pb2R26zAA/?ref=app
7 Answers
+ 9
Here is it fixed.
There are numerous errors.
*Manually calling constructor
*Returning a value from constructor (cout can not be returned like this)
*not supplying a value to constructor during initialisation
https://code.sololearn.com/cJvjUbtdqVUH/?ref=app
+ 9
yes. At least one of the functions will be required to return a string though.
example
string functionOne () {
return "Hello";
}
void functionTwo () {
string output = functionOne ();
cout << output << " this should work";
}
+ 8
Also you could use this method.
https://code.sololearn.com/cTkO1CvaPQo8/?ref=app
+ 5
You are welcome!
+ 3
Yes. Your compile error is due to defining Email() without implementing it. Delete line 8 and it runs.
+ 1
Can i append a string from one function to another function producing a string?
+ 1
Thank you. my goal is to put a time stamp next to a string, and you helped me a lot.