Reputation: 868
My classes are a bit large, so I want to split Outer
and Inner
into different files, but I still want to retain the structure, meaning that I have to type Outer.Inner
because that's what makes the most sense in my application.
// Outer.scala
class Outer
object Outer {
class Inner
object Inner
}
How would I go about doing that?
As far as I know Scala doesn't have partial classes like C#, so I'm a little lost on how to go about it.
I have seen this question and I'm not sure that it's helping me in this situation.
Upvotes: 3
Views: 92
Reputation: 48410
Perhaps split them out in traits and then mixin
// Foo.scala
trait Foo {
class Inner
object Inner
}
// Outer.scala
object Outer extends Foo
so now Outer.Inner
still works.
Upvotes: 4