I am having some serious issues with class inheritance. I am trying to make a MoneyBag class inherit from a class called bag. This will not work. I get an error complaining: error: expected class-name before '{' token. And yes I have googleing it and tried several of the various solutions offered with no avail.
The MoneyBag is pretty simple right now as I wanted to get it connected to bag before I tried to do anything with it.
//MoneyBag.h//
#ifndef MONEYBAG_H
#define MONEYBAG_H
#include <bag.h>
class MoneyBag : public bag{ ////<<------ Error appears on this line.
private:
value_type data[CAPACITY]; // The array to store items
size_type used; // How much of array is used
};
// NONMEMBER FUNCTIONS for the bag class
bag operator +(const bag& b1, const bag& b2);
}
So based on everything I have seen on line the statement:
class MoneyBag : public bag{ is legal.
As it is done this way on this very site's tutorial:
class Rectangle: public Shape, public PaintCost{
If someone could explain to me specifically what I am in particular doing wrong.
I am even willing for this to be a 'you're an idiot error' as I have wasted a lot of time on this one seemingly minor problem.