Invalid use of incomplete type “class…”

后端 未结 1 527
自闭症患者
自闭症患者 2020-12-22 13:49

I keep getting this error and I don\'t understand what I do wrong: \" error: invalid use of incomplete type \'class Auftrag\'\" at method getAuftrae

相关标签:
1条回答
  • 2020-12-22 14:49

    Place the function definitions after the definition of the class Auftrag.

    For example

    inline void  Kunde ::addAuftrag(Auftrag *auftrag){
        this->vpa.push_back(auftrag);
    }
    
    inline void  Kunde ::getAuftraege() {
        for (int i{0};i<vpa.size();i++)
            cout << this->vpa.at(i)->getID();
    }
    

    The compiler has to know the definition of the class Auftrag that to determine that it has such a data member as vpa.

    0 讨论(0)
提交回复
热议问题