Question : Hiding library private members.

I want to hide the private members of my (C++) library that I am creating. I have something like sub-class1, that is a private member of class1. Class1 obviously contains the header for sub-class1. When I compile the code into a library I want other developers to only see class1, but not bee able to see sub-class1 since it's private. Certainly I do not want other developers to be able to see the members of the private sub-class1 object. What methods are available to achieve this?

Thanks,
Matthew

Answer : Hiding library private members.

>> Then have a void pointer in the interface class which be casted into the library class whenever it needs to be accesses
Why do you need a void pointer? You can just forward declare the real type of the pointer in the header and then define a pointer of that type.

// HEADER
class ClassA; // This is a forward declaration and from this point on it can be used to define pointers and references

class ClassAInterface
{
ClassA * m_pClassA; // Valid
ClassA & m_rClassA; // Valid
}

>> Now the application can include the header for the interface, but that does not allow it to resovle whatever was in the library. Anyone care to comment on this?
Linking and compiling are unrelated. You still need to link to the library, the fact you are using a pimpl doesn't change this.
Random Solutions  
 
programming4us programming4us