一个友元声明的错误,找不出来啊,求帮忙
#include<iostream>#include<string>
using namespace std;
class shen_stock{
int general, ST, PT;
public:
shen_stock(int general = 0, int ST=0, int PT = 0);
void print(const shen_stock &a );
void addgen();
void addst();
void addpt();
friend void shang_stock::print(const shang_stock &a);
friend void count(const shen_stock&a, const shang_stock&b);
};
shen_stock::shen_stock(int g, int s, int p){
general = g;
ST = s;
PT = p;
}
void shen_stock::addgen(){ ++general; }
void shen_stock::print(const shen_stock &a){
cout << a.general << endl << a.ST << endl << a.PT << endl;
}
class shang_stock{
int general, ST, PT;
public:
shang_stock(int general = 0, int ST = 0, int PT = 0);
void print(const shang_stock &a);
void addgen();
void addst();
void addpt();
friend void shen_stock::print(const shen_stock &a);
friend void count(const shen_stock&a, const shang_stock&b);
};
shang_stock::shang_stock(int g, int s, int p){
general = g;
ST = s;
PT = p;
}
void shang_stock::addgen(){ ++general; }
void shang_stock::print(const shang_stock &a){
cout <<a.general << endl << a.ST << endl << a.PT << endl;
}
void count(const shen_stock&a, const shang_stock&b){
cout << a.general + b.general << endl;
}
int main(){
return 0;
}