-
HELP ME ABOUT string
This code doesn't compile and i couldn't find why.
I work in visual c++ environment.
It gives these family of errors:
*syntax error : missing ';' before '->'
*'root' : missing storage-class or type specifiers
*'root' : 'int' differs in levels of indirection from 'class data *'
Thanks a lot for helping:)
*******************************************
#include <iostream>
#include <string>
using namespace std;
class data{
public:
data();
string myname;
};
data::data(){};
main(){
data *root=new data();
(root->myname)="/";
return 0;
}
********************************************
-
It compiled for me. I think I remember some problem with some versions of MSVC and the string header. You could try getting the latest service pack or try re-arranging the order in which you include the headers.