+ 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; }
2 Answers
0
ya ofcourse no problem
0
change the return type of setName to void