jeudi 26 décembre 2019

c++ error: no matching constructor for initialization [closed]

I am calling a default constructor of a class with initializer list and getting error 'no matching constructor for initialization'

classA.h

explicit classA();

classA.cpp

//mMember local member which is initialized.

classA::classA() : mMember(getInstance()) {
    pObj = nullptr;
}

classB.cpp

  classAobj = classA(); // getting error: no matching constructor for initialization

Can somebody help with what I am missing here.

Aucun commentaire:

Enregistrer un commentaire