no matching function for call to 'Vector3d::Vector3d()'
je travail un exercice où il est demandé de tester une fonction mais en compilant je rencontre l'erreurs suivante:
no matching function for call to 'Vector3d::Vector3d()'
le fichier .h est comme suit:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| #ifndef VECTOR3D_H
#define VECTOR3D_H
class Vector3d
{
float x, y, z;
public:
Vector3d(float c1, float c2, float c3);
virtual ~Vector3d();
void coincide(Vector3d v1, Vector3d v2);
private:
};
#endif // VECTOR3D_H |
le fichier .cpp est comme suit:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| #include "Vector3d.h"
#include <iostream>
using namespace std;
Vector3d::Vector3d(float c1=0, float c2=0, float c3=0)
{
x=c1;
y=c2;
z=c3;
}
Vector3d::~Vector3d()
{
//dtor
}
void Vector3d::coincide(Vector3d v1, Vector3d v2)
{
if(v1.x==v2.x && v1.y==v2.y && v1.z==v2.z)
cout<<"les deux vecteurs coincident!";
} |
le fichier main.cpp où j'ai testé la fonction coincide() est comme suit:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| #include <iostream>
#include "Vector3d.h"
using namespace std;
int main()
{
Vector3d v1, v2;
v1(1,2,3);
v2(1,2,3);
coincide(v1,v2);
return 0;
} |
merci beaucoup vous m'avez beaucoup aider
merci beaucoup vous m'avez beaucoup aidé