Hi all,i hope someone can figure out whats stupid with this programme.I have a class which is for point in 2D which works quite good. And i want to create another class for vectors which should use point class on it. The class i wrote:
Code:#ifndef TVECTOR_H_ #define TVECTOR_H_ //#include <cmath> #include <math.h> #include "TPoint2D.h" #define PI 3.14159265 class TVector { public: TVector(); TVector(TPoint2D , TPoint2D ); TPoint2D const TVector::PointA() ; TPoint2D const TVector::PointB() ; private: TPoint2D pointA_,pointB_; }; TVector::TVector() { TPoint2D pointA_ = TPoint2D(); TPoint2D pointB_ = TPoint2D(); } TVector::TVector(TPoint2D pointA, TPoint2D pointB) { pointA_ = pointA; pointB_ = pointB; } TPoint2D const TVector::PointA() ; { return pointA_; } TPoint2D const TVector::PointB() ; { return pointB_; } #endif /*END OF TVECTOR_H_*/
And the errors i get:
and here how i declare my point class:PHP Code:TVector.h:47: error: declaration of `const TPoint2D TVector::PointA()' outside of class is not definition
TVector.h:48: error: expected unqualified-id before '{' token
TVector.h:48: error: expected `,' or `;' before '{' token
TVector.h:54: error: declaration of `const TPoint2D TVector::PointB()' outside of class is not definition
TVector.h:55: error: expected unqualified-id before '{' token
TVector.h:55: error: expected `,' or `;' before '{' token
Code:#ifndef TPOINT2D_H_ #define TPOINT2D_H_ //#include <cmath> #include <math.h> #define PI 3.14159265 class TPoint2D { public: TPoint2D(); TPoint2D(double coord1 , double coord2 ); double Distance(TPoint2D pointA, TPoint2D pointB); void Topla(TPoint2D pointA, TPoint2D pointB, TPoint2D &pointC); double Ro(TPoint2D pointA); double Phi(TPoint2D TpointA); double const TPoint2D::Coord1(); double const TPoint2D::Coord2(); private: double coord1_,coord2_; }; TPoint2D::TPoint2D() { coord1_ = 0.0; coord2_ = 0.0; } TPoint2D::TPoint2D(double coord1,double coord2) { coord1_ = coord1; coord2_ = coord2; } double const TPoint2D::Coord1() { return coord1_; } double const TPoint2D::Coord2() { return coord2_; }
Thanks in advance and sorry for wasting time



LinkBack URL
About LinkBacks


