Refactorings – Reduce Visibility
February 13th, 2012
Each member of a type declaration has an associated visibility (accessibility) modifier, which controls the access to this member for other members. The Reduce Visibility refactoring shipped in Refactor! Pro allows you to quickly reduce the visibility of a member to match the highest calling visibility, in other words, to restrict the visibility as much as possible.
For example, if a member is called only inside the current class and not outside of it, a member can have the ‘private’ visibility. If a member is called from only descendants of the current class, it may have the ‘protected’ visibility.
The refactoring is available on the visibility keyword:
Reducing the visibility may improve the clarity of your API.
—– Products: Refactor! Pro Versions: 11.2 and up VS IDEs: 2008 and up Updated: Feb/13/2012 ID: R051