Not really a huge issue, but I'm wondering if IntelliSense is messed up when it comes to friend functions in classes?
I have a class that uses the overloaded operators for ostream and istream (<<, >>), and I have them flagged as friend functions inside my class. So theoretically they should have access to the class's private members. The program compiles and runs fine, no errors - but as I'm continuing to write code, IntelliSense is constantly reporting that the member functions are inaccessible to the functions. It still compiles, but I'm wondering if this is a problem with IntelliSense or something on my end and I just happen to be getting lucky that's it's running at all?
friend std::ostream & operator <<(std::ostream &, const Rational &);
friend std::istream & operator >>(std::istream &, Rational &);
std::ostream & operator <<(std::ostream & outs, const Rational & source)
{
outs << source.itsNum << '/' << source.itsDen;
return outs;
}
std::istream & operator >>(std::istream & ins, Rational & target)
{
ins >> target.itsNum >> target.itsDen;
return ins;
}
frienddeclarations? - Some programmer dude