C++ IO流:标准输入输出流的重载

一、代码

#include 
using namespace std;

class Date
{
public:
        Date(int year, int month , int day) : m_year(year), m_month(month), m_day(day) { }

        //
        friend ostream& operator<<(ostream& os, Date& dt);

private:
        int m_year, m_month, m_day;
};

//
ostream& operator<<(ostream& os, Date& dt)
{
        os<

二、输出结果


你可能感兴趣的:(IO/文件读写)