我想在case
class
來定義屬性wait
,然而,它不斷給我一個錯誤:不能定義一個名爲`wait` Scala的情況下,類屬性
overriding method wait in class Object of type()Unit;
[error] value wait cannot override final member
[error] final case class Foo(wait: Bar)
final case class Foo(wait: Bar)
它看起來像wait
是基類中的一種方法,即使我的case類沒有從任何東西繼承。有沒有辦法仍然定義一個名爲wait
的類變量?