There is the following simplified data structure:
Object1.h
template
class Object1
{
private:
T a1;
T a2;
public:
T g
Add a typedef :
template <class T>
class Object1
{
private:
T a1;
T a2;
public:
T getA1() {return a1;}
typedef T type;
};
template <class Object>
void foo(Object *o1, Object *o2)
{
typename Object::type x = o1.getA1();
...
}
You can use this:
template <template<class> class Object, class T>
void func1(Object<T> &o1, Object<T> &o2)
{
T x = o1.getA1();
}
Working example at http://www.ideone.com/t8KON .
Btw. if you use pointers as parameters, you have to use ->
operator to call methods.