Why do we not override abstract values?

Let’s take this simple example:

abstract class Base {
  protected val _value: String
  
  def value: String = _value
}

class Test extends Base {
  protected val _value = "Hello"
}

val test = new Test()
println(test.value)

This works perfectly fine but I still have questions:

  1. Why is it not required to use override in Test?
  2. And why is it perfectly fine to actually use it?

Why is it not required to use override in Test ?

override is only required when overriding concrete implementations. _value in Base is abstract, so override is allowed by not required.

And why is it perfectly fine to actually use it?

Why wouldn’t it be?

The override keyword is a safety feature that lets you be specific about your intentions. It prevents you from erroneously overriding an implementation of a base class / trait if you didn’t mean to and it prevents you from not overriding an implementation you wanted to (but used overloading instead).

If you implement an abstract class, you have to implement all missing implementations, so one could argue that the overrides keyword is kind of redundant in this case.

FWIW, I always override abstract members, as I believe that serves to share intention, it makes clear to the reader which methods where defined somewhere else and which ones right there.