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

Scala example source code file (names-defaults-neg-ref.scala)

This example Scala source code file (names-defaults-neg-ref.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

a, a2235, a2235, app, b, b2235, b2235, c, int, int, string, string, test

The Scala names-defaults-neg-ref.scala source code

object Test extends App {
  // #2235
  new A2235 with B2235
}

// only one overloaded alternative is allowed to have defaults
class A {
  def foo(a: Int = 0) = a
  def foo(b: String = "another") = b
}

class B {
  def foo(a: Int) = a
  def bar(u: String = "ldksj") = u
}

class C extends B {
  override def foo(a: Int = 1092) = a
  def foo(b: String = "lskdfj")

  def bar(i: Int = 129083) = i
}

// #2235
trait A2235 { def f(x: Int = 1) = x }
trait B2235 { def f(x: String = "1") = x }

Other Scala examples (source code examples)

Here is a short list of links related to this Scala names-defaults-neg-ref.scala source code file:

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

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.