I want to create this in turbo c++ how to create plz help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

I want to create this in turbo c++ how to create plz help

#include <iostream> using namespace std; class myClass { public: myClass() { cout <<"Hey"; } void setName(string x) { name = x; } string getName() { return name; } private: string name; }; int main() { myClass myObj; return 0; }

13th Dec 2017, 5:08 AM
kalpesh Dharpure
kalpesh Dharpure - avatar
6 Answers
+ 2
Try using <iostream.h> , and remove the using namespace std; stmt. Also, you should call the setName and getName functions in your main fn. Hope it helps. :)
13th Dec 2017, 9:04 AM
Syed Bilal
Syed Bilal - avatar
+ 1
you have to include <string>
22nd Jan 2018, 12:34 PM
Artemix Volta (Artemix948)
Artemix Volta (Artemix948) - avatar
+ 1
I included but not worked
22nd Jan 2018, 12:35 PM
kalpesh Dharpure
kalpesh Dharpure - avatar
+ 1
What is the error ?
22nd Jan 2018, 12:38 PM
Artemix Volta (Artemix948)
Artemix Volta (Artemix948) - avatar
+ 1
string cannot start a parameter delclration type name expected declaration missing undefined symbol name after you said I put #include<iostream.h> #include<conio.h> #include<string> now it's 5error ?
22nd Jan 2018, 12:54 PM
kalpesh Dharpure
kalpesh Dharpure - avatar
+ 1
if I input int with not using string program works perfectly no error
22nd Jan 2018, 1:02 PM
kalpesh Dharpure
kalpesh Dharpure - avatar