|
|
|
Подскажите, ошибка где?
|
|||
|---|---|---|---|
|
#18+
Выдает сообщение: no appropriate default constructor available class CTriangle { float fABLenReal; float fBCLenReal; float fACLenReal; float fABLenPict; float fBCLenPict; float fACLenPict; float fXAngle; float fYAngle; V2dVector A; V2dVector B; V2dVector C; public: CTriangle( V2dVector a , V2dVector b, V2dVector c ) { fABLenReal = 5; fBCLenReal = 3; fACLenReal = 4; A = a; B = b; C = c; Get2DLen(a , b, &fABLenPict); Get2DLen(b , c, &fBCLenPict); Get2DLen(a , c, &fACLenPict); fXAngle = (float)asin(fABLenPict/fABLenReal); fYAngle = (float)asin(fACLenPict/fACLenReal); }; ~CTriangle(){}; V2dVector GetAngle(V2dVector A) { A.PutVect(fXAngle , fYAngle); return A; } //Interface Members: void Get2DCoordRelativeWorldCenter(V2dVector Pict ,V3dVector* Vect3dWorld ) { float fXPic; float fYPic; float fZPic; float fXWd; float fYWd; float fZWd; Pict.GetVect(&fXPic , &fYPic); fXWd = (float)(fXPic * sin(fXAngle)); fYWd = (float)(fYPic * cos(fYAngle)); // Vect3dWorld->PutVect(); }; private: void Get2DLen(V2dVector From , V2dVector To , float* TargetVar) { float x1,y1,x2,y2; From.GetVect(&x1,&y1); To.GetVect(&x2,&y2); *TargetVar = (float)sqrt( pow((float)(x1 - x2) , 2) + pow((float)(y1 - y2) , 2) ); }; }; V2dVector и V3dVector - ранее корректно объявленные классы. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.10.2006, 18:36 |
|
||
|
Подскажите, ошибка где?
|
|||
|---|---|---|---|
|
#18+
Где-то конструируется Triangle без параметров. Как только вы пишете свой конструктор, С++ автоматом удаляет свой, дефолтный - без параметра. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.10.2006, 18:44 |
|
||
|
Подскажите, ошибка где?
|
|||
|---|---|---|---|
|
#18+
Написано же нет конструктора по умалчанию(т.е. без параметров). Где-то наверняка еще и создаёшь обьект этого класса без параматров в конструкторе. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.10.2006, 18:44 |
|
||
|
Подскажите, ошибка где?
|
|||
|---|---|---|---|
|
#18+
вы бы полное сообщение об ошибке привели а вообще вот это Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. наводит на грустные размышления: здесь вызываются 6 конструкторов и 3 присваивания. так и задумано и все ли данные операции определены? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.10.2006, 18:46 |
|
||
|
Подскажите, ошибка где?
|
|||
|---|---|---|---|
|
#18+
Полностью: class V2dVector { float X; float Y; public: V2dVector(float x , float y) { X = x; Y = y; }; ~V2dVector(){}; GetVect(float* x , float* y) { *x = X; *y = Y; }; PutVect(float x , float y) { X = x; Y = y; }; }; class V3dVector { public: float X; float Y; float Z; V3dVector(float x , float y , float z) { X = x; Y = y; Z = z; }; ~V3dVector(){}; GetVect(float* x , float* y , float* z) { *x = X; *y = Y; *z = Z; }; PutVect(float x , float y, float z) { X = x; Y = y; Z = z; }; }; class CTriangle { float fABLenReal; float fBCLenReal; float fACLenReal; float fABLenPict; float fBCLenPict; float fACLenPict; float fXAngle; float fYAngle; V2dVector A; V2dVector B; V2dVector C; public: CTriangle( V2dVector a , V2dVector b, V2dVector c ) { fABLenReal = 5; fBCLenReal = 3; fACLenReal = 4; A = a; B = b; C = c; Get2DLen(a , b, &fABLenPict); Get2DLen(b , c, &fBCLenPict); Get2DLen(a , c, &fACLenPict); fXAngle = (float)asin(fABLenPict/fABLenReal); fYAngle = (float)asin(fACLenPict/fACLenReal); }; ~CTriangle(){}; V2dVector GetAngle(V2dVector A) { A.PutVect(fXAngle , fYAngle); return A; } //Interface Members: void Get2DCoordRelativeWorldCenter(V2dVector Pict ,V3dVector* Vect3dWorld ) { float fXPic; float fYPic; float fZPic; float fXWd; float fYWd; float fZWd; Pict.GetVect(&fXPic , &fYPic); fXWd = (float)(fXPic * sin(fXAngle)); fYWd = (float)(fYPic * cos(fYAngle)); // Vect3dWorld->PutVect(); }; private: void Get2DLen(V2dVector From , V2dVector To , float* TargetVar) { float x1,y1,x2,y2; From.GetVect(&x1,&y1); To.GetVect(&x2,&y2); *TargetVar = (float)sqrt( pow((float)(x1 - x2) , 2) + pow((float)(y1 - y2) , 2) ); }; }; ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.10.2006, 18:49 |
|
||
|
Подскажите, ошибка где?
|
|||
|---|---|---|---|
|
#18+
Как правильно интерпретировать параметры конструктора CTriangle:как вызов трех конструкторов или указание типов трех переменных? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.10.2006, 18:51 |
|
||
|
Подскажите, ошибка где?
|
|||
|---|---|---|---|
|
#18+
у вас нет конструктора по-умолчанию для V2dVector... так должно пройти: Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.10.2006, 19:01 |
|
||
|
|

start [/forum/search_topic.php?author=Alex1233&author_mode=last_posts&do_search=1]: |
0ms |
get settings: |
6ms |
get forum list: |
15ms |
get settings: |
6ms |
get forum list: |
10ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
584ms |
get topic data: |
8ms |
get forum data: |
2ms |
get page messages: |
30ms |
get tp. blocked users: |
1ms |
| others: | 1085ms |
| total: | 1751ms |

| 0 / 0 |
