C++ Stack Unable to process

Viewed 39

I am having an error in my program (Error: undefined reference to `customerRent::customerRent()') Appreciate your help and advice. Thank you

class customerRent: public customerQueue, public videoList {
private:
    int custRentVideoID;
    int custRentCustID;
//  stack<customerRent> custRent;
public:
    
    /*customerRent(int videoID, string movieTitle, string movieGenre, string movieProduction, int  numberOfCopies):videoList(videoID, movieTitle, movieGenre, movieProduction, numberOfCopies){
        }*/
    /*customerRent(int customerID, string customerName, string customerAddress):customerQueue(customerID, customerName, customerAddress){
        }*/
    customerRent(int custRentCustID, int custRentVideoID){
        this->custRentCustID = custRentCustID;
        this->custRentVideoID = custRentVideoID;
        }
        customerRent(); //constructor
    void rentVideo ();
    void returnVideo ();
    void listVideoByCust();
    void exit ();
    

};

int main(){
int counter = 0;
videoList vlist;
customerQueue cQueue;
customerRent cStack;

        case 2:
            cStack.rentVideo();
            cout << endl;
            system("pause");
            break;
1 Answers

you might want to consider change your default constructer from

 customerRent(); //constructor

to

 customerRent() //constructor
 {}

or as @prehistoricpenguin rightly pointed out change to

customerRent()=default; // for c++11 and above

this declaration customerRent cStack; is looking for a default constructor which is never defined

Related