mardi 23 février 2016

Implement copy constructor with bridge pattern c++

I'm studying c++ and trying to implement the bridge pattern, when this happens, I have My implementation file with constructors:

 SystemImpl::SystemImpl() {
    this->name = "";
    this->value = 0.0;
    this->maxValue = DBL_MAX;
}

SystemImpl::SystemImpl(const SystemImpl& sys) {
    this->name = sys.name;
    this->value = sys.value;
    this->maxValue = sys.maxValue;
}

And now, I'm creating the interface that use this implementation, where imps is my pointer to implementation class:

System::System() {
    imps = new SystemImpl();
}

System::System(const System& sys) {
    imps = new SystemImpl(sys);
}

The fisrt constructor work's fine, but the second, that's a copy constructor, shows no matching function for call to ‘SystemImpl::SystemImpl(const System&)’

What's wrong?

Aucun commentaire:

Enregistrer un commentaire