I need to pass a vector into a constructor, but the vector is initialized in the constructor, and when I accept a vector, I am getting an error that says no matching constructor for initialization. How would I edit the constructor to accept this?
class Polynomial {
public:
    Polynomial(const vector<int>& vec) {
//Stuff 
};
int main() {
   Polynomial p1({17});
   Polynomial p2({5, 4, 3, 2, 1});
}
Aucun commentaire:
Enregistrer un commentaire