vendredi 6 septembre 2019

How many constructors can an inherited class have?

When I'm trying to create multiple constructors for an inherited class, I have an error throw out saying: No matching function call to A::A(). My codes are shown as below:

class A{  
public:  
    int a;  
    int b;  
    A(int i, int k) : a(i), b(k){  

    };  

};  

class B : public A{  
public:  
    B(){  

    };  
    B(int i, int k) : A(i, k){  
    };  


};  

Aucun commentaire:

Enregistrer un commentaire