i have the following class
Code:
#ifndef H_Student
#define H_Student
#include <iostream>
#include <string>
using namespace std;
class Student
{
friend ostream& operator<< (ostream&, const Student&);
public:
Student(string n="",float g = 0.0f,long j = 0):name(n),gpa(g),jagID(j){};
string convertJag(long);
friend class StudentNode;
friend class NodeList;
private:
string name;
float gpa;
long jagID;
};
with ostream in .cpp
Code:
ostream& operator<< (ostream& output, const Student& s)
{
output <<s.name<<", GPA = "<<s.gpa<<", JagID = "<<convertJag<<s.jagID;
return output;
}
the errors i get are:
29 expected `,' or `...' before '&' token
30 ISO C++ forbids declaration of `Student' with no type
In function `std:stream& operator<<(std:stream&, int)':
31 `s' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
[Build Error] [Student.o] Error 1
what am i typing in wrong ive looked in 3-4 different books and they the same syntax for overloading<<