alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (S2.scala)

This example Scala source code file (S2.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

j, j, s1, s1, s2, s2, s3, s4, s4, s5

The Scala S2.scala source code

package a.b
package c

import a.b.J

/** Variations of java-access-pos with us in a nested package.
 */

/** Declaring "override" all the time.
 */
class S1 extends J {
  override private[b] def packageAbstract() = ()      // fail
  override protected[b] def protectedAbstract() = ()
  override def publicAbstract() = ()
  
  override private[b] def packageConcrete() = ()      // fail
  override protected[b] def protectedConcrete() = ()
  override def publicConcrete() = ()
}

/** Implementing abstracts.
 */
class S2 extends J {
  private[b] def packageAbstract() = ()     // fail
  protected[b] def protectedAbstract() = ()
  def publicAbstract() = ()
}

/** Widening access.
 */
class S3 extends J {
  protected[b] def packageAbstract() = ()   // fail
  protected[b] def protectedAbstract() = ()
  def publicAbstract() = ()
  
  override protected[b] def packageConcrete() = ()    // fail
  override protected[b] def protectedConcrete() = ()
  override def publicConcrete() = ()
}
/** More widening.
 */
class S4 extends J {
  private[a] def packageAbstract() = ()         // fail
  protected[a] def protectedAbstract() = ()
  def publicAbstract() = ()
  
  override private[a] def packageConcrete() = ()        // fail
  override protected[a] def protectedConcrete() = ()
  override def publicConcrete() = ()
}
/** Yet more widening.
 */
class S5 extends J {
  def packageAbstract() = ()      // fail
  def protectedAbstract() = ()
  def publicAbstract() = ()
  
  override def packageConcrete() = ()   // fail
  override def protectedConcrete() = ()
  override def publicConcrete() = ()
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala S2.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.