If you have a class that inherits from two traits, that both have the same method, you would get an error from the compiler. For example, that's what you would get by inherting from both CustomComponent and Property in Scaladin:
class AddressComponent inherits conflicting members:
method readOnly in trait Component of type => Boolean and
method readOnly in trait Property of type => Boolean
(Note: this can be resolved by declaring an override in class AddressComponent.);
other members with override errors are: readOnly_=, p
class AddressComponent extends CustomComponent with Property[Address] {
The solution is indeed to define an override, but how do you tell it which of the super classes to use? Here is how:
class AddressComponent extends CustomComponent with Property[Address] {
override def readOnly = super[CustomComponent].readOnly
override def readOnly_=(readOnly: Boolean) = super[CustomComponent].readOnly = readonly
}
Actually, that is a bad example, since both traits have method "p", which is going to create an unresolvable compilation time conflict:
overriding method p in trait Property [and] value p in class CustomComponent ha[ve] incompatible type[s]