Scala

From Celeste@Hoppinglife
Revision as of 22:33, 26 May 2020 by Hoppinglife (talk | contribs) (Created page with "=== Type bounds === <code>B <: U</code> imposes a ''upper bound'' on type <code>U</code>, while <code>B >: L</code> imposes a ''lower bound''. This is useful for generic meth...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Type bounds

B <: U imposes a upper bound on type U, while B >: L imposes a lower bound. This is useful for generic methods that takes only classes on a particular inheritance tree as its type parameters.

The official tour has a pretty good explanation: Upper bounds and Lower bounds