Continuing from this question: Why can't you reduce the visibility of a method in a Java subclass?
I need to create class B
that is almost identical to class A
, except that B
cannot do certain things that A
can.
Being a lazy programmer as I am, I tried to inherit A
, only to greet with error that B
cannot reduce the visibility of A
methods. Duh!..
Now A
is an API from a vendor, my intention is to encapsulate this API so that it is easier to use.
I wonder what is the best practice to work around this?
See Question&Answers more detail:os