#include <iostream>
#include <string>

using namespace std;

template<class T>
class Base
{
public:
	auto VirtualFuncInterface()// How to write in C++11 or older style?
	{
		return static_cast<T*>(this)->VirtualFuncImpl();
	}
};
class Derived : public Base<Derived>
{
public:
	bool VirtualFuncImpl()
	{
		cout << "Derived" << endl;
		return true;
	}
};
class Derived2 : public Base<Derived2>
{
public:
	double VirtualFuncImpl()
	{
		cout << "Derived2" << endl;
		return 94.87;
	}
};
template<class T>
void Poly(Base<T>* b)
{
	cout<<b->VirtualFuncInterface()<<endl;
}
int main()
{
	Base<Derived2>* ptr = new Derived2;
	Base<Derived>* ptr2 = new Derived;
	Poly(ptr);
	Poly(ptr2);
	return 0;
}