Hiding protected functions and members from the user?
My classes are event driven so for example, the public mouseClick() calls the protected onMouseClick().
I find that it might be puzzling if the user's开发者_StackOverflow社区 intellisense picks up on all the protected ones. Is there a way to minimize this confusion in any way?
Thanks
Member access control in C++ is for compilers, not for users. If you really need that, you should use ABCs as interfaces and create your objects through factories. This way you can make sure no end-user ever has to see any non-interface part of your code.
Good implementation of intellisense should not pick them up. I don't think there isn't much you can do to prevent it programatically.
The editorbrwsable atribute is used by intellisense to know wheter the user should see the method or not. While a blanket option is probably available in intellisense to hide protected functions, but if all else fails, you could use this.
精彩评论