All pastes #276683 Raw Edit

Untitled

public text v1 · immutable
·published 2006-12-12 16:38 UTC
rendered paste body
// ============== File Item.h:
#ifndef _Item_H
#define	_Item_H

# include <iostream>

namespace misc {

class Item {
  public:
    Item(int n) : _n(n) {}

  private:
    const int _n;

  friend std::ostream &operator << (std::ostream&, const Item&);
};

}; // end namespace misc

#endif	/* _Item_H */

// ============== File Item.cc:
# include "Item.h"

std::ostream &operator << (std::ostream &os, const misc::Item &item) {
  return (os << '[' << item._n << ']');
};