Refactor internal encapsulation method to support extension and protected members.