Hi, i am trying to create a interface where its methods are protected or only visible to the class that implements it.
The issue is this. i have two classes that do more or less the exact same thing but with different parameters and behaviour, but the actual steps it takes is identical.
i was thinking ok i have two similar classes so lets just create a interface that both these classes implement. Should be ok right? well it is. it does the job but with a serious flaw, All and i mean all of the methods it overrided in these two classes are now visible to the naked eye.
They can be accessed as they are defined "public". there goes encapsulation :(
Another solution i thought of was using a abstract class but wait, you can only extend one abstract class and the two classes i am using already extend a class(in my case a android Service class) so out goes that idea too.