开发者

Restrict Function Calls in Child Class

I have a base class Base, and derived classes from it such as DerivedA, DerivedB etc. And I have task classes derived from android.os.AsyncTask such as TaskA, Task B, TaskC etc.

What I want to accomplish is restricting calls in Task classe开发者_高级运维s to specific Derived classes. Such as

TaskA can call functions from DerivedA, but not from DerivedB,DerivedC etc ...


Every class can call public methods. You could restrict access by putting your classes in separate packages and use package-private access. See here if you don't know it already.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜