friend/method functions

i'm trying to use the method friends in this class 3...here is the error im getting.

Error 2316 112: 'Host3::seeData(Class3)' is not a member of 'Host3'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class Host3;
class Class3: public Class2{
protected:
int *p5;
public:
Class3();
~Class3();
void inputData();
void showData();
friend int Host3::seeData(Class3 );
}; // Class3

Class3::Class3(){
cout << "\n\n\tClass3 Constructor";
p5 = new int;
}
Class3::~Class3(){
cout << "\n\n\tClass3 Destructor";
delete p5;
}
void Class3::inputData(){
cout << "\n\tEnter a character >> ";
cin >> *p1;
cout << "\n\tEnter a float >> ";
cin >> *p2;
cout << "\n\tEnter a string >> ";
cin >> *p4;
cout << "\n\tEnter an integer >> ";
cin >> *p5;
} 
void Class3::showData(){
cout << "\n\n\t" << *p2 << " is the float";
cout << "\n\n\t" << *p4 << " is the string";
cout << "\n\n\t" << *p5 << " is the integer";
}

class Host3{
public:
Host3(){cout<<"\n\tHost3C";}
~Host3(){cout<<"\n\tHost3D";}
int seeData(Class3 );
};

Host3::seeData(Class3 ){
cout << "\n\tEnter a character >> ";
cin >> *p1;
cout << "\n\tEnter a float >> ";
cin >> *p2;
cout << "\n\tEnter a string >> ";
cin >> *p4;
cout << "\n\tEnter an integer >> ";
cin >> *p5;
return 0;
}


thats my source code, i'm not really sure what im doing wrong.
Last edited on
You're missing the return type.

Topic archived. No new replies allowed.