[ create a new paste ] login | about

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

C++, pasted on May 22:
#include <iostream>

class ClassB {
  int a, b;
public:
  ClassB(int a, int b) {
    this->a = a; this->b = b;
    std::cout << "ClassB:constructor " << this->a << ',' << this->b << std::endl;
  }
  ~ClassB() { std::cout << "ClassB:destructor " << std::endl; }
  void f() { std::cout << "ClassB:f() " << this->a * 2 << ',' << this->b * 2 << std::endl; }
};

void f(ClassB *g) {
  g->f();
}

int main() {
  f(&ClassB(123, 456));
  return 0;
}
/* end */


Output:
1
2
3
cc1plus: warnings being treated as errors
In function 'int main()':
Line 19: warning: taking address of temporary


Create a new paste based on this one


Comments: