I have a hierarchy of templated classes that are constructed in one place and are passed around to other places to do some operations on them.
For example, a class could be templated to some complex object which knows how to convert itself to a double, and the templated class has an operation to output this object as a double. An example of a utility function would be a function that outputs collections of this class as a table.
However, I do not want to pass in this type as a templated class, because the utility function should work on any concrete class variant because they can all represent themselves as double. Therefore I want to have some non-templated interface that has the 'represent as double' function. Why does the following not work?
#include "stdafx.h"
class Interface1
{
public:
    virtual int ReturnSomeInt();
};
template<typename myType>
class TClass1 : public Interface1
{
public:
    int ReturnSomeInt() {return 5;}
    void CalculateSomething(myType myValue) {}
    TClass1() {}
};
//---------------------------------------------
class Interface2 : public Interface1
{
public:
    virtual double ReturnSomeDouble();
};
template<typename myType>
class TClass2 : public TClass1<myType>, public Interface2
{
public:
    double ReturnSomeDouble() {return 9.2;}
    void CalculateSomethingElse(myType myValue) {}
    TClass2() {}
};
//---------------------------------------------
int _tmain(int argc, _TCHAR* argv[])
{
    Interface2 myInterface = TClass2<float>();
    int myInt = myInterface.ReturnSomeInt();
    double myDouble = myInterface.ReturnSomeDouble();
    return 0;
}
I get a link error 2019 about the fact that it could not find the symbol Interface2::ReturnSomeDouble(void). What could be the problem?
 
     
     
     
    