scala - base class constructor parameter in trait -


i have base class constructor parameter:

abstract class hugeclass(implicit context: contextclass) {    ... } 

because class gets bigger , bigger , subclasses need special behaviour, want refactor trait. however, still need access context in trait. tried this:

trait sometrait extends hugeclass {     def mymethod = {         context.method     }  } 

but scala compiler says: not found: value context. how can solve that?

parameter context turned private field. fact parameter or member implicit not mean public - implicit within class visible in (hugeclass). turn context val:

abstract class hugeclass(implicit val context: contextclass) {    ... } 

and work.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -