📜  istream c++ 代码示例

📅  最后修改于: 2022-03-11 14:44:48.122000             🧑  作者: Mango

代码示例1
//These functions can access the private data of the class that declared them to be friends!
     std::istream& operator>>(std::istream& ist, Book& b){
         ist >> b.price >> b.title >> b.author;
         return ist;
     }
     std::ostream& operator<<(std::ostream& ostr, const Book& b){
         ostr << "Title: " << b.title << "   Autor: " << b.author << "   Price: "<< b.price ; 
         return ostr;
     }