I have a trait "Foo" with some methods. I want to mix this trait to any class. But I dont want to write something like
val b = new Bar with Foo
I need something like where I just pass a class and it is mixed with Foo. I want to mix with this trait only i.e it is fixed that all classes should be mixed with Foo trait only.
val b = new Factory(Bar) //Factory returns instance with trait Foo
I found this post but I am not convinced.
Something like this is possible in scala?