android - How to hide public methods within inheritable class -
I want to hide some methods from the user in the inherited square. For example:
Expands public square test textview {public trial (reference reference) {super.onCreate (reference); } / * Hide this method / / Override protected zero set text (four recurring text) {super. Text (text); }} And then I do not want to see this method within the test class. How can I do this? Sorry for my english
It looks like a design problem because it hides a base class As a little dirty, assigning sub-classes should still be able to call base class methods.
You can, however, do one of the 2 things.
-
Mark excluded as the method Note: Typically used people are asked not to use method B / C, it will be removed soon , But still works at the present, but it will not work at all here (approximately) ...
And unsupported operation throw the exception in the method so that you / others are caught it quickly, called it goes.
/ * * @Deprecated Do not call this method * / @depracted @ override protected zero set text (four tolerance text) {new unsupported operation throw exception ("not supported"); } -
Think about the structure instead of subclassing, I mean by creating a class that wraps the desired class and only what you want Are there. If you need a general interface between the original class and your wrapper class, then create an interface, both of which implement and use the interface, but using your new class immediately
Comments
Post a Comment