Can I make a copy of a case class with abstract override while maintaining functionality
Say I define the following traits and case class trait A { def f(): Unit = println("A") } trait B extends A { abstract override def f(): Unit = println("B") } case class C() extends A { } And then construct and copy it thus: val c = new C() with B c.f() val c2 = c.copy() c2.f() Then of course my output is B A Is there an elegant way one can make a copy of a this case class while maintaining the B extended functionality?
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.