I'm getting an
expected class-name before '{' token
in the following code
the saltwaterfish.h header file:
#ifndef SALTWATERFISH_H
#define SALTWATERFISH_H
class saltwaterfish: public fish
{
public:
saltwaterfish();
float GetUnitPrice();
float GetWeight();
};
#endif // SALTWATERFISH_H
Is this the correct way to define the header file for
"saltwaterfish is a subclass of fish" ?
the only thing I have in saltwaterfish.cpp is
#include "fish.h"
#include "saltwaterfish.h"
the fish.cpp class:
#include "fish.h"
#include <iostream>
#include "freshwaterfish.h"
#include "saltwaterfish.h"
using namespace std;
fish::fish()
{
};
float fish::CalculatePrice()
{
return GetUnitPrice()*GetWeight();
}
float fish::GetUnitPrice()
{
return 1.0;
}
float fish::GetWeight()
{
return 1.0;
}