mardi 28 juin 2016

std::basic_ostream is inaccessible in C++

I get the following error and I'm not sure what the issue is

1 IntelliSense: "std::basic_ostream<_Elem, _Traits>::basic_ostream(const std::basic_ostream<_Elem, _Traits>::_Myt &_Right) [with _Elem=char, _Traits=std::char_traits]" (declared at line 82 of "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\ostream") is inaccessible

Book.cpp

ostream operator<< (ostream& out, const Book & b){
    out << "Title: " << b.my_Title << endl;
    out << "Author: " << b.my_Author << endl;
    out << "Number of time checkout out: " << b.my_NumberOfTimesCheckedOut;
    return(out);
}

I get the issue with the return(out);

Book.h

#ifndef BOOK_H
#define BOOK_H
#include <string>
using namespace std;
namespace CS20A
{
    class Book {
    public:
        Book();
        Book( string author, string title );
        string getTitle() const;
        string getAuthor() const;
        int getNumberOfTimesCheckedOut() const;
        void increaseNumberOfTimesCheckedOut( int amount=1 );
        friend ostream operator<< ( ostream& out, const Book & b );
    private:
        string my_Author;
        string my_Title;
        int my_NumberOfTimesCheckedOut;
    };
};
#endif

I don't even understand what the error is telling me

Aucun commentaire:

Enregistrer un commentaire