scala - Using the override keyword on implementations of abstract methods -


is practice use override keyword when implementing abstract methods defined in traits?

trait tooth {   def ache(): unit }  class molar extends tooth {   override def ache(): unit = {} } 

in above example, understand override keyword optional; advisable? on side of terseness vs. safety trade-off should fall?

override 1 thing there: when removing tooth.ache not implementations later on, compiler errors. in particular, forces implementations of tooth (written or others) "close" tooth in sense, namely deprecated methods vanish (or @ least reconsidered).

this may or may not desired.


Comments