I have this template class
MyTemplates.h
#ifndef MYTEMPLATES_H
#define MYTEMPLATES_H
#include <iostream>
#include "Main.h"
template <class T>
class myTemplates
{
T difference(T,T);
};
template <class T>
T myTemplates<T>::difference(T a,T b)
{
return t ((a.getX() - b.getX()),(a.getY() - b.getY()) );
}
Main.cpp
Point p_a (2, 8);
Point p_b (5, 10);
cout << endl;
cout << "difference (p_a, p_b) returns a point with value : ";
p = difference (p_a, p_b);
cout << p << endl << endl;
When i run this, i will get the error called, "differences were not declared in this scope". What i'm trying to do here is to pass two objects into the template and returns the differences in value. in my point class, i have a ostream operator that display the x and y ordinates