I wrote a C++ wrapper class for a C API.
My wrapper class has a private instance member of a typedef structure used in the original API. I do not want to modify the API header file, but I also want to hide all traces of the original API, so I DO NOT want to include the original API header file in the wrapper class' header.
I'm probably overlooking something really simple, but I'm not finding it. PIMPL is an option, but I'd prefer to seek alternatives before refactoring the whole codebase for one little thing.
wrapper.hpp
class myWrapper
{
public:
myWrapper();
private:
originalTypedef *original; // forward declaration needed for originalTypedef
};
wrapper.cpp
#include "wrapper.hpp"
#include "originalAPI.h"
myWrapper::myWrapper()
{
original = originalAPI_get();
}
Main.cpp
#include "wrapper.hpp"
int main()
{
myWrapper wrapper = new myWrapper();
}