How to make a variable private to a trait?

后端 未结 4 654
广开言路
广开言路 2021-02-05 13:17

I\'d like to reuse a functionality several times in a single class. This functionality relies on a private variable:

tr         


        
4条回答
  •  孤独总比滥情好
    2021-02-05 13:34

    i may be a little late for the party, but the behavior you are trying to create is not something that should be covered by a trait, but by simple object composition.

提交回复
热议问题