I am reading the example 5.2.2 from http://www.scala-lang.org/docu/files/ScalaReference.pdf ==>
Example 5.2.2
A useful idiom to prevent clients of a class from constructing new instances of that class is to declare the class abstract and sealed :
object
m {
abstract sealed class
C (x: Int) {
def nextC = new C(x + 1) {} } val= empty = new C(0) {}
}
For instance, in the code above clients can create instances of class m.C only by call- ing the nextC method of an existing m.C object; it is not possible for clients to create objects of class m.C directly. Indeed the following two lines are both in error:
new m.C(0) **** error: C is abstract, so it cannot be instantiated.
new m.C(0) {} ****error: illegal inheritance from sealed class.
====
I cant understand how inheritance is declared !! Thanks