codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <iostream> #define DEBUG Debug(__FUNCTION__, __LINE__) class Debug { public: Debug (const char* f, int line) { std::cout << f << " (" << line << ")> "; } ~Debug () { std::cout << std::endl; } template <typename T> void operator << (const T& t) { std::cout << t; } }; class B { }; class C { }; class A { public: A (const B& b) { DEBUG; } A (const A& a) { DEBUG; } void operator= (const C& c) { DEBUG; } }; int main () { DEBUG << "create b"; B b; DEBUG << "create c"; C c; DEBUG << "create a from b"; A a = b; DEBUG << "copy b to a"; a = b; DEBUG << "copy c to a"; a = c; }
Private
[
?
]
Run code
Submit