Reputation: 3051
i want to use a method of anothre class in another one,but i get error below,whats the problem? TIA
error: no matching function for call to ‘PositionInfo::PositionInfo()’
here is my code:
PositionInfo Pos;
double metr=Pos.GetBallDistToTeammate(5);
and PositionInfo.h class is:
PositionInfo(WorldState *pWorldState, InfoState *pInfoState);
and PositionInfo.cpp class is:
const double & GetBallDistToTeammate(Unum unum) const { Assert(unum > 0); return GetBallDistToPlayer(unum); }
Upvotes: 2
Views: 3442
Reputation: 63698
Default constructor PositionInfo::PositionInfo() { /* code */}
is missing in your cpp file.
Upvotes: 2
Reputation: 92271
error: no matching function for call to ‘PositionInfo::PositionInfo()’
This seems like someone tries to call a default constructor for the class, but the compiler cannot find one.
Upvotes: 2