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
Post a Comment