#compound-types #scala
Compound types can consist of several object types and they may have a single refinement which can be used to narrow the signature of existing object members.
The general form is: A with B with C ... { refinement }
If you want to change selection, open document below and click on "Move attachment"
Compound Types - Scala Documentationspecify the type of obj to be both Cloneable and Resetable. This compound type is written like this in Scala: Cloneable with Resetable.
Here’s the updated function:
def cloneAndReset(obj: Cloneable with Resetable): Cloneable = {
//...
}
<span>Compound types can consist of several object types and they may have a single refinement which can be used to narrow the signature of existing object members.
The general form is: A with B with C ... { refinement }
An example for the use of refinements is given on the page about abstract types.
Please enable JavaScript to view the comments powered by Disqus.
blog comments powered by Dis Summary
| status | not read | | reprioritisations | |
|---|
| last reprioritisation on | | | suggested re-reading day | |
|---|
| started reading on | | | finished reading on | |
|---|
Details