Skip to main content
4 events
when toggle format what by license comment
Jul 25, 2018 at 21:58 history edited Deduplicator CC BY-SA 4.0
copy-edited
Apr 22, 2012 at 1:14 comment added S.Robins @leftaroundabout I don't recall calling this a cast in any language in particular. Yes, it's ugly, but the point being made isn't about how to cast, but rather that the interface allows each of the classes represented to be called in the same way. I'm aware that I could have use an "as" operator, or that I could have simply passed each object to a method. As a quick example however ugly, this allows me to make a specific point, in the simplest manner I could think of.
Apr 21, 2012 at 23:20 comment added leftaroundabout Do you call this a cast in Java? Urgh. It's a reference cast, or base-class-pointer cast as we'd call it in C++. Which does not actually cast the object in the sense that anything changes about its implementation (like when you cast a float to double), it just creates are more general pointer that can dispatch over the class hierarchy's vtable. IMO quite an important distinction.
Apr 21, 2012 at 10:44 history answered S.Robins CC BY-SA 3.0