Having troubles inheriting base class

Posted by Nick on Stack Overflow See other posts from Stack Overflow or by Nick
Published on 2012-04-09T23:10:45Z Indexed on 2012/04/09 23:30 UTC
Read the original article Hit count: 154

Filed under:
|

When I inherit the base class, it's telling me there is no such class

This is enhanced.h:

  class enhanced: public changeDispenser // <--------where error is occuring
    {
    public:
        void changeStatus();
        // Function: Lets the user know how much of each coin is in the machine
        enhanced(int);
        // Constructor
        // Sets the Dollar amount to what the User wants
        void changeLoad(int);
        // Function: Loads what change the user requests into the Coin Machine
        int dispenseChange(int);
        // Function: Takes the users amount of cents requests and dispenses it to the user

    private:
        int dollar;
    };

This is enhanced.cpp:

#include "enhanced.h"
#include <iostream>
using namespace std;
enhanced::enhanced(int dol)
{
    dollar = dol;
}

void enhanced::changeStatus()
{
    cout << dollar << " dollars, ";
    changeDispenser::changeStatus();
}

void enhanced::changeLoad(int d)
{
    dollar = dollar + d;
    //changeDispenser::changeLoad;
}

This is changeDispenser.h:

class changeDispenser
{
public:
    void changeStatus();
    // Function: Lets the user know how much of each coin is in the machine
    changeDispenser(int, int, int, int);
    // Constructor
    // Sets the Quarters, Dimes, Nickels, and Pennies to what the User wants
    void changeLoad(int, int, int, int);
    // Function: Loads what change the user requests into the Coin Machine
    int dispenseChange(int);
    // Function: Takes the users amount of cents requests and dispenses it to the user
private:
    int quarter;
    int dime;
    int nickel;
    int penny;
};

I didn't include the driver file or the changeDispenser imp file, but in the driver, these are included

#include "changeDispenser.h"
#include "enhanced.h"

© Stack Overflow or respective owner

Related posts about c++

Related posts about inheritance