J'ai la classe template suivante :
template <class Type>
class Point3D
{
public :
Point3D(Type posX, Type posY, Type posZ) {...}
Point3D() {x = 0; y = 0; z = 0;}
Point3D<Type>& operator=(const Point3D<Type>&) { ??? }
...
private :
Type x, y, z;
};
Comment surcharger :
Point3D<Type>&
operator=(const Point3D<Type>&)
Pour pouvoir écrire : Point3D<float> point = Point3D<int>(...,...,...);
Sans avoir à la compilation : erreur: conversion from 'Point3D<int>' to non-scalar type 'Point3D<float>' requested
Merci.