Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. class Int {
  4.  public:
  5.   Int() : m_a(0) { }
  6.   Int(int a) : m_a(a) { }
  7.  
  8.   void Subtract(const Int& f) { m_a -= f.m_a; }
  9.   Int Subtract(const Int& f) const { return Int(f.m_a); }
  10.  
  11.   int a() const { return m_a; }
  12.  
  13.  private:
  14.   int m_a;
  15. };
  16.  
  17. Int myfunc() {
  18.   Int first(6);
  19.   Int second(2);
  20.  
  21.   return first.Subtract(second);
  22. }
  23.  
  24. int main()
  25. {
  26.   Int f = myfunc();
  27.   printf("%d\n", f.a());
  28.   return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement