1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| #pragma once
template <class T, int N = 3>
class point
{
private:
T tab[N];
public:
point(T a = 0, T b = 0, T c = 0);
~point();
T getVal(int);
//T operator[](int);
};
template <class T, int N = 3>
point<T>::point(T a = 0, T b = 0, T c = 0)
{
tab[1] = a;
tab[2] = b;
tab[3] = c;
}
template <class T, int N = 3>
point<T>::~point()
{
delete tab;
}
//template <class T, int N = 3>
//T point<T>::operator[](int i)
//{
// return tab[i];
//}
template <class T, int N = 3>
T point<T>::getVal(int i)
{
return tab[i];
} |
Partager