Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
If a concrete class contain 5 method and out of 5 method one another cass want to use only 2 method and another class want to user rest 3 method , how we will do this in modular programming?
Posted
Updated 6-Dec-15 19:59pm
v2

1 solution

Access specifiers don't specify the subject of granting access, such as types where the access is used. If the access modifier is "private", the member is not accessed by any classes, is "public" — it is accessed by all classes, and so on. Please see the documentation and draw your conclusion for your code design: https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html[^].

The end of this article give some rule-of-thumb recommendations.

One of design approaches you can use is to split those 2 and 3 methods between different classes, but it will never be the way you wanted. And perhaps the lack of the feature you are looking for leads, which you may consider as a limitation, actually stimulates better design decisions than those you keep in mind.a

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900