hiding inner class implementation using namespace

Posted by Abruzzo Forte e Gentile on Stack Overflow See other posts from Stack Overflow or by Abruzzo Forte e Gentile
Published on 2010-05-11T12:13:22Z Indexed on 2010/05/11 12:24 UTC
Read the original article Hit count: 230

Filed under:

Hi all

I am developing a library and a would like to provide my users a public interface separate from the real implementatino that is hidden in a namespace. This way, I could change only the class HiddenQueue without changing myQueue that will be exposed to users only.

If I put the C++ code of HiddenQueue in the myQueue.cpp file the compiler complains saying _innerQueue has incomplete type. I thought that the linker was able to resolve this. What I am doing wrong here?

Thanks

Afg

// myQueue.h
namespace inner{
    class HiddenQueue;
};

class myQueue{

public:
    myQueue();
);

private:

    inner::HiddenQueue _innerQueue;

};

///////////////////////////

// myQueue.cpp
namespace inner{
    class HiddenQueue{};
};

© Stack Overflow or respective owner

Related posts about c++