Chapter 5, Exercise 7
Change the class Cookie as specified in the section labeled
"protected: inheritance access". Verify that bite() is not public.
package x;
class Cookie {
Console.println("Cookie constructor");
protected def bite = Console.println("bite");
}
object c5x7 {
def main ( args: Array[String] ) = {
val x = new Cookie;
x.bite;
}
}
scalac responds with the following error message:
c5x7.scala:12: method bite cannot be accessed in x.Cookie
x.bite;
^
one error found
12:09:28 AM