Constructor problem
-
How do I implement this?
tCircle::tCircle( double fNewX, double fNewY, double fNewRadix )
: cCenter.fX( fNewX ), cCenter.fY( fNewY ), nRadix ( fNewRadix )
{
}I get the error "error C2059: syntax error : '.'" at "cCenter.fX( fNewX )" regards hint_54 -- modified at 20:24 Friday 14th April, 2006
-
How do I implement this?
tCircle::tCircle( double fNewX, double fNewY, double fNewRadix )
: cCenter.fX( fNewX ), cCenter.fY( fNewY ), nRadix ( fNewRadix )
{
}I get the error "error C2059: syntax error : '.'" at "cCenter.fX( fNewX )" regards hint_54 -- modified at 20:24 Friday 14th April, 2006
If your class looks like this: class tCircle { double fX; double fY; double fRadix public: tCircle( double fNewX, double fNewY, double fNewRadix ); }; Constructor implementaiton could be: tCircle::tCircle( double fNewX, double fNewY, double fNewRadix ) : fX( fNewX ), fY( fNewY ), nRadix ( fNewRadix ) {} gmileka
-
If your class looks like this: class tCircle { double fX; double fY; double fRadix public: tCircle( double fNewX, double fNewY, double fNewRadix ); }; Constructor implementaiton could be: tCircle::tCircle( double fNewX, double fNewY, double fNewRadix ) : fX( fNewX ), fY( fNewY ), nRadix ( fNewRadix ) {} gmileka
-
No. I have
class tDot {
public: float fX, fY;
};
class tCircle {
public: tCircle( void ); tCircle( float, float, float ); tCircle( tDot, float ); public: float fRadix; tDot cCenter;
};
I'm having trouble with the 2nd constructor. Thx ;) hint_54
I would add a constructor to tDot. class tDot { public: float fX, fY; tDot(float newfX, float newfY){ fX=newfX; fY=newFY; }; }; class tCircle { public: tCircle( void ); tCircle( float, float, float ); tCircle( tDot, float ); public: float fRadix; tDot cCenter; }; tCircle::tCircle(double newX, double newY) : cCenter( newX, newY) { } gmileka
-
How do I implement this?
tCircle::tCircle( double fNewX, double fNewY, double fNewRadix )
: cCenter.fX( fNewX ), cCenter.fY( fNewY ), nRadix ( fNewRadix )
{
}I get the error "error C2059: syntax error : '.'" at "cCenter.fX( fNewX )" regards hint_54 -- modified at 20:24 Friday 14th April, 2006
You should either use cCenter(fNewX, fNewY), assuming tDot have a constructor accepting two arguments or move cCenter.fX and cCenter.fY within the function body. -Saurabh
-
You should either use cCenter(fNewX, fNewY), assuming tDot have a constructor accepting two arguments or move cCenter.fX and cCenter.fY within the function body. -Saurabh
-
I would add a constructor to tDot. class tDot { public: float fX, fY; tDot(float newfX, float newfY){ fX=newfX; fY=newFY; }; }; class tCircle { public: tCircle( void ); tCircle( float, float, float ); tCircle( tDot, float ); public: float fRadix; tDot cCenter; }; tCircle::tCircle(double newX, double newY) : cCenter( newX, newY) { } gmileka