Hide class type in header

后端 未结 2 1850
既然无缘
既然无缘 2021-01-22 00:40

I\'m not sure if this is even possible, but here goes:

I have a library whose interface is, at best, complex. Unfortunately, not only is it a 3rd-party library (and far

2条回答
  •  Happy的楠姐
    2021-01-22 01:15

    Essentially, you need a separate set of headers for each use. One that you use to build your DLL and one with only the exported interfaces, and no mention at all of the encapsulated objects. Your example would look like:

    class Node
    {
    public:
        String GetName();
    };
    

    You can use preprocessor statements to get both versions in the same physical file if you don't mind the mess.

提交回复
热议问题