PS
This code is not complete but it serves its purpose and works.
I'm getting an error saying that I'm getting a construction error.
Expected Primary-expression before int.(That would be were it link FrozenPizza::FrozenPizza(blah blah) : FrozenFood(blahblah) {}
Again this is an example of the code, the read code is..
#include <cstdlib>
#include <iostream>
using namespace std;
class Food {
public: //Make private..humph..check them all an figure out the small diffs
int Money;
int Cost;
int Quantity;
int Size;
Food(int ACost, int AQuantity, int ASize);
void virtual Buy ();
int GetMoney();
int GetCost();
};
class Dairy : public Food {
public:
string Animal;
int Expiration;
public:
Dairy(int ACost, int AQuantity, int ASize, string AAnimal,
int AExpiration);
};
class Milk : public Dairy {
public:
int Gallons;
string CartonType;
string Color;
public:
Milk(int ACost, int AQuantity, int ASize, string AAnimal,
int AExpiration, int AGallons, string ACartonType, string AColor);
};
Food::Food(int ACost, int AQuantity, int ASize) {
Cost = ACost;
Quantity = AQuantity;
Size = ASize;
}
Dairy:
airy(int ACost, int AQuantity, int ASize, string AAnimal,int AExpiration) : Food(int ACost,int AQuantity,int ASize){
Animal = AAnimal;
Expiration = AExpiration;
I get big errors mentioned above from this line, I tried to mimic the code in the previous post.
PS. I have no idea what an inherited class exactly is used for, nor do I know how, But i'm trying to get a feel for how to write it when I fine out more about the purpose. Sorry my posts kinda suck.
I'm learning programming out of a book, I'm stuck, I can't design a hierarchy of classes.
If you don't care to write a nice explanation, a link would be nice to another forum or place to explain this. thank you.
<code>
#include <cstdlib>
#include <iostream>
using namespace std;
class FrozenFood {
private:
int Price;
protected:
int Weight;
public:
FrozenFood(int APrice, int AWeight); // a constructor
int GetPrice();
int GetWeight();
virtual void BakeChemistry();
};
class FrozenPizza : public FrozenFood {
protected:
int Diameter;
public:
FrozenPizza(int Aprice, int AWeight, int ADiameter);
void DumpInfo();
void BakeChemistry();
};
class DeepDishPizza : public FrozenPizza {
private:
int Height;
public:
DeepDishPizza(int APrice, int AWeight, int ADiameter, int AHeight);
void DumpDensity();
};
FrozenFood::FrozenFood(int APrice, int AWeight){
Price = APrice;
Weight = AWeight;
</code>

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic