Damit sieht unsere soweit fertige Vektorklasse wie folgt aus:
class CVector { private: static double epsilon; static int instances; private: int dimension; double *vector; public: /* constructors and destructor */ CVector(int dimension=3); CVector(const CVector& v); ~CVector(); /* input and output */ friend ostream& operator<<( ostream& os, const CVector& v ); friend istream& operator>>( istream& is, CVector& v ); /* some operators */ CVector& operator=(const CVector& v); CVector operator+(const CVector& v) const; CVector operator-(const CVector& v) const; double operator*(const CVector& v) const; CVector operator+() const; CVector operator-() const; CVector operator!() const; CVector operator*(double d) const; friend CVector operator*( const CVector& v, double d ); double& operator[](int i) const; /* useful functions */ int Dimension() const; double Length() const; bool IsNullVector() const; CVector SolvePolynom() const; /* control functions */ void SetEpsilon(); void GetEpsilon(); void GetInstances(); };