I have the "Foo" trait with some methods. I want to mix this trait with any class. But I do not want to write something like
val b = new Bar with Foo
I need something like where I just went through the class and it mixes with Foo. I want to mix with this attribute only ie, it is fixed that all classes should be mixed only with the Foo attribute.
val b = new Factory(Bar)
I found this post , but I'm not sure.
Is something like this possible in scala?
source
share