[ create a new paste ] login | about

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

C++, pasted on Sep 9:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

struct Base
{
  Base() { std::cout << typeid(*this).name() << std::endl; }
  virtual ~Base() { std::cout << "~" << typeid(*this).name() << std::endl; }

  void Init() const { std::cout << typeid(*this).name() << std::endl; }
};

struct Derived : public Base
{
};

int main()
{
  Derived d;
  d.Init();
  return 0;
}


Output:
1
2
3
4Base
7Derived
~4Base


Create a new paste based on this one


Comments: