Classes. Friends errors

closed account (EwCjE3v7)
For some reason I am getting the following errors when compileing, even when I have the friend declaration added:

./ST.h:21:8: error: use of undeclared identifier 'F_Name'
is >> F_Name >> L_Name >> DOB >> cls;
^
./ST.h:21:18: error: use of undeclared identifier 'L_Name'
is >> F_Name >> L_Name >> DOB >> cls;
^
./ST.h:21:28: error: use of undeclared identifier 'DOB'
is >> F_Name >> L_Name >> DOB >> cls;
^
./ST.h:21:35: error: use of undeclared identifier 'cls'
is >> F_Name >> L_Name >> DOB >> cls;
^
./ST.h:27:8: error: use of undeclared identifier 'F_Name'
os << F_Name << " " << L_Name << " " << DOB << " " << cls;
^
./ST.h:27:25: error: use of undeclared identifier 'L_Name'
os << F_Name << " " << L_Name << " " << DOB << " " << cls;
^
./ST.h:27:42: error: use of undeclared identifier 'DOB'
os << F_Name << " " << L_Name << " " << DOB << " " << cls;
^
./ST.h:27:56: error: use of undeclared identifier 'cls'
os << F_Name << " " << L_Name << " " << DOB << " " << cls;
^
ST.cpp:17:3: error: expected expression
}
^
9 errors generated.



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
#ifndef StudentT_H
#define StudentT_H

#include <iostream>
#include <fstream>
#include <string>

class Student
{
public:
	friend std::istream &input(std::istream &, Student &);
	friend std::ostream &print(std::ostream &, Student &);
	friend std::ofstream &save(Student &);
private:
	std::string F_Name, L_Name, DOB;
	unsigned cls;
};

std::istream &input(std::istream &is, Student &per)
{
	is >> F_Name >> L_Name >> DOB >> cls;
	return is;
}

std::ostream &print(std::ostream &os, Student &per)
{
	os << F_Name << " " << L_Name << " " << DOB << " " << cls;
	return os;
}

std::ofstream &save(Student &per)
{
	std::ofstream ofs_Name("SName.txt"), ofs_DOB("SDOB.txt"), ofs_Class("SClass.txt");
}

#endif // StudentT_H 
is >> per.F_name >> per.L_Name >> per.DOB >> per.cls;
Same with others.
closed account (EwCjE3v7)
OH, waw really stupid error. Thank you. I just took a brake from c++ so I have forgotten a few things
Topic archived. No new replies allowed.