[ create a new paste ] login | about

Link: http://codepad.org/bDNpkUJL    [ raw code | output | fork ]

C++, pasted on Oct 12:
#include <string>
#include <iostream>

class Book
{
public:
  const std::string getTitle() const { return "title"; }
  const std::string getYear() const { return "year"; }
};

std::ostream& operator<<
(
  std::ostream& os,
  const Book& b
)
{
  os << b.getTitle() << ", " << b.getYear();
  return os;
}

int main()
{
  Book b;
  std::cout << b << std::endl;
}


Output:
1
title, year


Create a new paste based on this one


Comments: