假设我在 Scala 中有一堂课:
class Class123(val val1: Int, val val2: String, val val3: AnotherClass, val val4: AnotherClass2)
//I create Class123 somehow, it doesn't matter how exactly
val class123_1: Class123 = parseClass123()
现在我想创建另一个与除了最后一个参数Class123
完全相同的实例,我希望它有所不同:class123_1
val4
val class123_2 = // the same as class123_1 but with different last parameter val4
我怎么做?