/*
 * @topic T00295 Apr 11 -- overloaded operator<< demo
 * @brief class Counter and overloaded <tt>operator&lt;&lt;</tt>
*/

#ifndef _COUNTER_H_INCLUDED_
#define _COUNTER_H_INCLUDED_

class Counter {
    // data
    int m_count;

public:
    // class constructors
    Counter()
    {
        m_count = 0;
    }

    // class operations
    void increment()
    {
        ++m_count;
    }
    int get_count()
    {
        return m_count;
    }
};//class Counter

// overloaded operators
// Note: std::ostream is the type of cout
std::ostream& operator<<( std::ostream& out, Counter& cnt )
{
    out << "[" << cnt.get_count() << "]";
    return out;
}

#endif //_COUNTER_H_INCLUDED_