class - Inheritance functions in java -


this question has answer here:

duplicate of disabling inherited method on derived class

this class codes:

class parent{     public bool sum(int a){return true;}      public int mul(int a){return a*a;}  } 

and 2 classes extends parent class:

class derived extend parent{     //here child can see 2 methods of parent class ,     //i want see sum method in here , don't see mul method } class derivedb extend parent{ //here child can see 2 methods of parent class , //i want here see mul method. } 

you can making mul private method in parent class. mul method has visibility inside parent class

class parent{     public bool sum(int a){return true;}      private int mul(int a){return a*a;}  } 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -