1
0
Fork 0
psychic-wallhack/ptrtest.cpp

14 lines
394 B
C++
Raw Normal View History

2016-12-02 06:24:20 -08:00
#include <memory>
#include <iostream>
#define GenPrint(name) \
name() {std::cout << #name "()\n";} \
~name() {std::cout << "~" #name "()\n";}
class Base {public: GenPrint(Base)};
class A {public: GenPrint(A) std::shared_ptr<Base> base;};
class Derived : public Base {public: GenPrint(Derived)};
int main() {A a; a.base.reset(new Derived());}