+ 1

Sts , can string be a return typ ) but whn(^^)int(^^) or (^^)char(^^) 's put gives otput but fr(^^)string(^^) shws No oupt ,

// ) otpt : No output // (^^)string(^^) fr hgh lght #include <iostrea> #include <string> using namespace std; class myClass { public: (^^)string(^^) setName(string x) { name = x; } string getName() { return name; } private: string name; }; int main() { myClass myObj; myObj.setName("John"); cout << myObj.getName(); return 0; }

19th Dec 2016, 6:25 AM
ram
2 Antworten
0
ya ofcourse no problem
19th Dec 2016, 6:31 AM
manish rawat
manish rawat - avatar
0
change the return type of setName to void
19th Dec 2016, 6:45 AM
Ravi Kumar
Ravi Kumar - avatar