/// illustrating http://stackoverflow.com/a/99622/2932052
#include <iostream>
using namespace std;

class A
{
  A *pThis;
  public:
  A()
   : pThis(this)
  {
  }

  void callFoo()
  {
    pThis->foo(); // call through the pThis ptr which was initialized in the constructor
  }

  virtual void foo() = 0;
};

class B : public A
{
public:
  virtual void foo()
  {
  }
};

int main() {
	// your code goes here
	B b;
	b.callFoo();
	return 0;
}