नहीं है, लेकिन:
$ scala -Yoverride-objects
Welcome to Scala version 2.11.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_11).
Type in expressions to have them evaluated.
Type :help for more information.
scala> trait A { object O } ; trait B extends A { override object O }
defined trait A
defined trait B
scala> trait A { final object O } ; trait B extends A { override object O }
<console>:8: error: overriding object O in trait A;
object O cannot override final member
trait A { final object O } ; trait B extends A { override object O }
^
संभवत: कभी कभी लोगों को यह करना चाहते हैं। (For instance.)
स्रोत
2014-09-28 02:24:10
यह बिल्कुल सही है। हालांकि, मुझे इसके बारे में मनाने के लिए कुछ समय लगा। थोड़ी अधिक वर्बोज़, दर्दनाक विस्तार के लिए, [इस डुप्लिकेट प्रश्न] में अपडेट देखें (http://stackoverflow.com/questions/30265070/whats-the-point-of-nonfinal-singleton-objects-in-scala)। यह भी देखें [यह प्रश्न] (http://stackoverflow.com/questions/17308141/what-are-the-subtle-differences-between-val-and-singleton-objects) –