Ich bin ein Anfänger in c++
, ich weiß, es gibt viele ähnliche Fragen, aber leider hat mir nicht geholfen, dieses Problem zu lösen (was ist ein konzeptioneller missverstanden, denke ich)keine übereinstimmende Funktion für Aufruf zum Fehler in C++
so habe ich diese constructor
Field::Field(const Position &posG, const Position &posC) {
//...
}
und ich bin die Schaffung eines Field
wie
// Create positions
Position posG, posC;
posG.x = 3;
posG.y = 3;
posC.x = 4;
posC.y = 4;
// Create pointers to positions
const Position *pPosC(&posC);
const Position *pPosG(&posG);
// Create field
Field field (pPosG, pPosC);
Wo Position i s
struct Position {
int x;
int y;
};
Dann ich erhalte diese Ausnahme:
main.cpp:27:30: error: no matching function for call to ‘Field::Field(const Position*&, const Position*&)’
Field Field (pPosG, pPosC);
In file included from main.cpp:2:0:
Hilfe? Grüße
Verwenden 'Feldfeld (* pPosG, * pPosC);' oder 'Feldfeld (posG, PosC);' statt. – skypjack
// Feld erstellen Feldfeld (* pPosG, * pPosC); – systemcpro