Does anyone knows why this code cannot be compiled in visual studio 2013? The problem lies in this that b.a() has only one version (the overrided one in B class a(float)) and version a(std::string) is unavailable although it is in base class.
#include <string>
template <typename T>
class A {
public:
virtual void a(std::string b){ this->a(123); }
virtual void a(float b) = 0;
};
class B : public A < std::string > {
public:
virtual void a(float b) override {}
};
main()
{
B b;
b.a(""); // Error here: error C2664:
// 'void B::a(float)' : cannot convert argument 1 from 'const char [1]' to 'float'
B* bb = new B();
bb->a(""); // same
}