C++ examples for Class:Constructor
string("Sam") creates a temporary instance.
#include <iostream> #include <string> using namespace std; void WriteMe(string str) { cout << "Here I am: " << str << endl; } int main()//from w w w. ja v a 2 s. c o m { WriteMe(string("Sam")); return 0; }