Aladdin - Scala Bugtracking
[#198] project: specification priority: low category: feature
submitter assigned to status date submitted
Matthias Martin won't fix 2003-10-15 14:11:38.0
subject Scoping surprise
code
class A {
  protected val f: Int = 1;
}
class B(f: Int) extends A {
  def g = Pair(f, this.f);
}
object Test with Executable {
  Console.println((new B(7)).g);
}
what happened
The program produces the following output:
(1,1)
what expected I would have expected that f refers to the constructor parameter in the body of class B. But obviously, there seems to be no way to access the constructor parameter at all.
[back to overview]
Changes of this bug report
Martin  edited on  2003-10-16 11:38:59.0
Correct. Constructor parameters are in a scope which encloses the class template. The latter contains also all inhrited members.