0

Please anyone tell me what is the problem in the code given below

https://code.sololearn.com/cI6r0QWl3ie8/?ref=app

29th Sep 2017, 10:13 AM
Sourov Majumder
Sourov Majumder - avatar
4 Answers
+ 5
@Sourav I wrote name = x but you wrote name x Correct it and then it will run fine
29th Sep 2017, 10:53 AM
Kartikey Sahu
Kartikey Sahu - avatar
+ 4
#include <iostream> using namespace std; class MyClass{ private: string name; public : MyClass (string sourav){ setname (sourav); } void setname(string x){ name = x;} string getname(){ return name;} }; int main() { MyClass obj1("PSG"); MyClass obj2("BAYERN"); cout<<obj1.getname(); return 0; }
29th Sep 2017, 10:20 AM
Kartikey Sahu
Kartikey Sahu - avatar
+ 1
Yes thank you
29th Sep 2017, 10:55 AM
Sourov Majumder
Sourov Majumder - avatar
0
Its still not working Kartikey sahu
29th Sep 2017, 10:36 AM
Sourov Majumder
Sourov Majumder - avatar