-
Notifications
You must be signed in to change notification settings - Fork 21
Add virtual classes #634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Imported From: https://issues.scala-lang.org/browse/SI-634?orig=1 |
Geoffrey Alan Washburn (washburn) said: |
Geoffrey Alan Washburn (washburn) said: |
@odersky said: |
@paulp said: |
@soc said: class Foo {
class Bar {
def foo = 1
}
}
class SubFoo extends Foo {
class Bar {
def foo = 42
}
}
// Let's create some instances:
val foo = new Foo
val fooBar = new foo.Bar
fooBar.foo //> res0: Int = 1
// ok
val subFoo = new SubFoo
val subFooBar = new subFoo.Bar
subFooBar.foo //> res1: Int = 42
// ok
val superFoo: Foo = subFoo
val superFooBar = new superFoo.Bar
superFooBar.foo //> res2: Int = 1
// NOT OK! The last result is scary, because the syntax looks like things are dynamically bound, but the method is called on the static type instead. Mailing list: https://groups.google.com/d/topic/scala-language/vQYwywr0LL4/discussion |
@soc said: |
@soc said: |
Finish implementing virtual classes based upon the current proposal.
The text was updated successfully, but these errors were encountered: