#include <iostream>
#include <functional>
using namespace std;

class A {
protected:
    virtual int get() {
        cout << "in A::get" << endl;
        return 0;
    }
public:
    template<typename Function>
    A(const Function & get_ptr) {
        get_ptr();  // NOT get() !
    }
};

class B : public A {
protected:
    int get() override {
        cout << "in B::get" << endl;
        return 0;
    }
public:
    B() : A([=]{ B::get(); })
    //           ^^^^^^^^  this is undefined behavior, as `this` is not yet a B*!
    {
    }
};

int main() {
	B b;
	return 0;
}