You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to provide a This type to certain classes which is always the same as the static type of the object we're dealing with, but is more permissive than this.type (which for instance wouldn't let me return a perfect clone of the current object. I cam up with this:
I would have expected the compiler to complain about the missing makeClone method in Derived1, but it accepts it without a problem. If I then try
vald=newDerived1
d.makeClone.derived1Method
then I get a java.lang.!ClassCastException: Derived0 cannot be cast to Derived1. If I override makeClone in Derived1 to return a new Derived1 instance, it sure works.
Scala: 2.8.1.final
Java: 1.6.0_22
Operating system: Mac OS X 10.6.5
The text was updated successfully, but these errors were encountered:
I'm trying to provide a This type to certain classes which is always the same as the static type of the object we're dealing with, but is more permissive than this.type (which for instance wouldn't let me return a perfect clone of the current object. I cam up with this:
I would have expected the compiler to complain about the missing makeClone method in Derived1, but it accepts it without a problem. If I then try
then I get a java.lang.!ClassCastException: Derived0 cannot be cast to Derived1. If I override makeClone in Derived1 to return a new Derived1 instance, it sure works.
Scala: 2.8.1.final
Java: 1.6.0_22
Operating system: Mac OS X 10.6.5
The text was updated successfully, but these errors were encountered: