#scala #traits
Child classes extending a trait can give implementation for the un-implemented methods.
If you want to change selection, open document below and click on "Move attachment"
Scala Traits def isEqual(x: Any): Boolean
def isNotEqual(x: Any): Boolean = !isEqual(x)
}
This trait consists of two methods isEqual and isNotEqual. Here, we have not given any implementation for isEqual where as another method has its implementation. <span>Child classes extending a trait can give implementation for the un-implemented methods. So a trait is very similar to what we have abstract classes in Java. Below is a complete example to show the concept of traits:
trait Equal {
def isEqual(x: Any): Boolean
def isNotEq Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details