java - Override a public method that accesses private members -


i working on huge code base has huge class many private members , public , private methods. want create derived class base class have same members , methods, except 1 of public methods have line commented. how can that?

i thought of overriding method, method accesses many private members of base class.

below skeleton of want do.

public class base {     private var1;     private var2;      public tobeoverriden(){        processa(var1);        processb(var1);        processc(var1);  // needs commented        processd(var2);        processe(var2);    } } 

ideally -

public class derived extends base{     @override     public tobeoverriden(){        processa(var1);        processb(var1);        processd(var2);        processe(var2);    } } 

this not possible because cannot access private variables of base class. there can without making private members protected? please note overriding processc() empty not option because can used other non-overriden methods.

if have access base class can start making new method want, such correctedtobeoverridden(). extended class, override tobeoverridden() , have call correctedtobeoverridden().

correctedtobeoverridden(){     processa(var1);      processb(var1);      processd(var2);     processe(var2); }   @override  tobeoverridden() {     correctedtobeoverridden(); }  

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -