mercredi 27 février 2019

C++ class constructor no matching function for call to

Hi i try to creat one object t of the class Test but i have this error : no matching function for call to ‘testZEG::Test::Test(std::__cxx11::string&, std::__cxx11::string&, std::__cxx11::string&, std::__cxx11::string&)

// test.h

namespace testZEG{
class Test{
    public:
        Test(const std::string& param_1, const std::string& param_2, int param_3);
    private:
        std::string param_1;
        std::string param_2;
        int param_3;
};
}


// test.cpp
namespace testZEG{
    Test::Test(const std::string& param_1, const std::string& param_2, int param_3,)
    : m_param_1(param_1), m_param_2(param_2),m_param_3(param_3) {}
}

//main.cpp

int main(){
    string p1, p2, p3;
    char buffer[256];

    cin.getline(buffer, 255);
    p1= buffer;
    cin.getline(buffer, 255);
    p2= buffer;
    cin.getline(buffer, 255);
    p3= buffer;

    Test t(p1, p2, p3);
}

What is the cause ? How can i fix it ? thank's in advance

Aucun commentaire:

Enregistrer un commentaire