+ 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; }
6 odpowiedzi
+ 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. :)
+ 1
you have to include <string>
+ 1
I included but not worked
+ 1
What is the error ?
+ 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 ?
+ 1
if I input int with not using string program works perfectly no error