Skip to content
Browse files

SI-6195 stable members can only be overridden by stable members

  • Loading branch information...
1 parent 1921528 commit aa6e4b3abaf30072efe1e826470095bc27d68de8 @adriaanm adriaanm committed Mar 12, 2014
Showing with 12 additions and 4 deletions.
  1. +12 −4 07-classes-and-objects.md
View
16 07-classes-and-objects.md
@@ -350,16 +350,24 @@ $M'$:
- If $M$ and $M'$ are both concrete value definitions, then either none
of them is marked `lazy` or both must be marked `lazy`.
-A special rule concerns parameterless methods. If a paramterless
-method defined as `def $f$: $T$ = ...` or `def $f$ = ...` overrides a method of
-type $()T'$ which has an empty parameter list, then $f$ is also
-assumed to have an empty parameter list.
+A stable member can only be overridden by a stable member.
+For example, this is not allowed:
+
+```
+class X { val stable = 1}
+class Y extends X { override var stable = 1 } // error
+```
Another restriction applies to abstract type members: An abstract type
member with a [volatile type](#volatile-types) as its upper
bound may not override an abstract type member which does not have a
volatile upper bound.
+A special rule concerns parameterless methods. If a parameterless
+method defined as `def $f$: $T$ = ...` or `def $f$ = ...` overrides a method of
+type $()T'$ which has an empty parameter list, then $f$ is also
+assumed to have an empty parameter list.
+
An overriding method inherits all default arguments from the definition
in the superclass. By specifying default arguments in the overriding method
it is possible to add new defaults (if the corresponding parameter in the

0 comments on commit aa6e4b3

Please sign in to comment.
Something went wrong with that request. Please try again.