Reputation: 1648
So I'm trying to overload the << operator. From all the sources I can see, the syntax is correct, but eclipse doesn't like it.
I'm getting a couple errors: Polynomial::PrivateStruct* Polynomial::head is private
And: struct Polynomial::PrivateStruct is private.
I want to keep this struct private as to hide implementation details.
std::ostream& operator<<(std::ostream& outputStream, Polynomial& rhs)
{
Polynomial::PrivateStruct *p = rhs.head;
//implementation details
return outputStream;
}
and the declaration:
friend std::ostream& operator<<(std::ostream& outputStream, const Polynomial& rhs);
Upvotes: 0
Views: 315
Reputation: 55425
The declaration and the definition don't match - one takes a reference to const
, the other to non-const. Match them and you're good to go.
Upvotes: 6