@@ -501,14 +501,13 @@ declaration in a template. Such members can be accessed only from
501
501
within the directly enclosing template and its companion module or
502
502
[ companion class] ( #object-definitions ) .
503
503
504
- The modifier can be _ qualified_ with an identifier $C$ (e.g.
505
- ` private[$C$] ` ) that must denote a class or package
506
- enclosing the definition. Members labeled with such a modifier are
507
- accessible respectively only from code inside the package $C$ or only
508
- from code inside the class $C$ and its
504
+ A ` private ` modifier can be _ qualified_ with an identifier $C$ (e.g.
505
+ ` private[$C$] ` ) that must denote a class or package enclosing the definition.
506
+ Members labeled with such a modifier are accessible respectively only from code
507
+ inside the package $C$ or only from code inside the class $C$ and its
509
508
[ companion module] ( #object-definitions ) .
510
509
511
- An different form of qualification is ` private[this] ` . A member
510
+ A different form of qualification is ` private[this] ` . A member
512
511
$M$ marked with this modifier is called _ object-protected_ ; it can be accessed only from within
513
512
the object in which it is defined. That is, a selection $p.M$ is only
514
513
legal if the prefix is ` this ` or ` $O$.this ` , for some
@@ -533,11 +532,10 @@ Protected members of a class can be accessed from within
533
532
- all templates that have the defining class as a base class,
534
533
- the companion module of any of those classes.
535
534
536
- A ` protected ` modifier can be qualified with an
537
- identifier $C$ (e.g. ` protected[$C$] ` ) that must denote a
538
- class or package enclosing the definition. Members labeled with such
539
- a modifier are also accessible respectively from all code inside the
540
- package $C$ or from all code inside the class $C$ and its
535
+ A ` protected ` modifier can be qualified with an identifier $C$ (e.g.
536
+ ` protected[$C$] ` ) that must denote a class or package enclosing the definition.
537
+ Members labeled with such a modifier are also accessible respectively from all
538
+ code inside the package $C$ or from all code inside the class $C$ and its
541
539
[ companion module] ( #object-definitions ) .
542
540
543
541
A protected identifier $x$ may be used as a member name in a selection
@@ -744,7 +742,7 @@ which when applied to parameters conforming to types $\mathit{ps}$
744
742
initializes instances of type `$c$[$\mathit{tps}\,$]` by evaluating the template
745
743
$t$.
746
744
747
- ###### Example
745
+ ###### Example – `val` and `var` parameters
748
746
The following example illustrates `val` and `var` parameters of a class `C`:
749
747
750
748
```scala
@@ -753,7 +751,7 @@ val c = new C(1, "abc", List())
753
751
c.z = c.y :: c.z
754
752
```
755
753
756
- ### Example Private Constructor
754
+ ###### Example – Private Constructor
757
755
The following class can be created only from its companion module.
758
756
759
757
``` scala
@@ -835,7 +833,7 @@ This defines a class `LinkedList` with three constructors. The
835
833
second constructor constructs an singleton list, while the
836
834
third one constructs a list with a given head and tail.
837
835
838
- ## Case Classes
836
+ ### Case Classes
839
837
840
838
``` ebnf
841
839
TmplDef ::= `case' `class' ClassDef
0 commit comments