X
xhy_China
Hello:
This evening I make a cpp file(it's a sample of c++
primer,chapter 3,string.cpp).The outline of it is below:
#include <iostream>
// line 1
class string;
istream& operator>>(istream&,string&); //
line 4
ostream& operator<<(ostream&,const string&);
class string
{
public:
string();
virtual ~string();
};
string::string()
{
//Do something
}
string::~string()
{
//Do something
}
istream& operator>>(istream& io,string& s)
{
//Do something
}
ostream& operator<<(ostream& os,string& s)
{
//Do something
}
int main()
{
//Do something
}
After I run the program,compiler tell me that missing ";"
before "&" in line 4,also line 5. I dont
know why(I use VC++ 6.0)??? Then I download the code of the book to
run,but it caused the same
error! why? How to modify the code???
Thx
This evening I make a cpp file(it's a sample of c++
primer,chapter 3,string.cpp).The outline of it is below:
#include <iostream>
// line 1
class string;
istream& operator>>(istream&,string&); //
line 4
ostream& operator<<(ostream&,const string&);
class string
{
public:
string();
virtual ~string();
};
string::string()
{
//Do something
}
string::~string()
{
//Do something
}
istream& operator>>(istream& io,string& s)
{
//Do something
}
ostream& operator<<(ostream& os,string& s)
{
//Do something
}
int main()
{
//Do something
}
After I run the program,compiler tell me that missing ";"
before "&" in line 4,also line 5. I dont
know why(I use VC++ 6.0)??? Then I download the code of the book to
run,but it caused the same
error! why? How to modify the code???
Thx