mercredi 15 juin 2016

Template class with operator overload


Here is my question about template class

aclass<int> A{1,2};
aclass<float> B{3.0,4.0};
aclass<int> C;

int main()
{
  C=A+B;   //How to overload this operator in a simple way?
  B=A;   //And also this?
  return 0;
}

How can I overload operator to handle template class with different types? (Sorry for my poor English)


Aucun commentaire:

Enregistrer un commentaire