Pure Virtual Class, AbstractThing.hpp:
#ifdef ABSTRACT_INTERFACE_FOR_THING
#define ABSTRACT_INTERFACE_FOR_THING
namespace A
{
namespace B
{
template <class T>
class AbstractThing
{
public:
virtual ~AbstractThing() = 0;
virtual T GetStatus() = 0;
};
}
}
#endif
Header File, Thing.hpp:
#ifdef _THING_H
#define _THING_H
#include "AbstractThing.hpp"
namespace A
{
namespace B
{
template <class T>
class Thing : public AbstractThing<T> {
public:
Thing();
~Thing();
T GetStatus();
};
}
}
#endif
Source file, Thing.cpp,
#include "Thing.hpp"
namespace A
{
namespace B
{
template <class T>
Thing<T>::Thing() {}
template <class T>
Thing<T>::~Thing() {}
template <class T>
T Thing<T>::GetStatus() { ... }
}
}
I keep running into this issue where compiler the complains about the class name (Thing) not being a type. However, it is declared in the header file. From reading other posts, it seems like this issue is generally caused by failing to pre-declare a function or class. However, I don't see why my code does not accomplish this. I thought that it might be a namespace issue because GetStatus() will compile if I remove the namespace access (Thing::), but removing the namespaces did not help.