Simplify Number.h. Don't include "Integer.h" and "Double.h" in it. You are not even referencing anything from those files in this file.
#ifndef NUMBER // I'd recommend using NUMBER_H instead of just NUMBER
#define NUMBER
#include <iostream>
#include <string>
using std::string;
namespace MyNamespace {
class Number : public string
{
public:
Number();
Number(string s);
};
}
#endif
Remove #include "Integer.h"
from Double.h. Similarly, remove #include "Double.h"
from Integer.h. Add a forward declaration of Integer
in Double.h and a forward declaration of Double
in Integer.h.
#ifndef DOUBLE
#define DOUBLE
#include "Number.h"
namespace MyNamespace
{
class Integer;