4 ms·
someMethod() could return an implementation of Employee that overloads the fire method to dispatch missiles. The point being, someMethod is doing some job that
by ajanuary 3y ago
someMethod() could return an implementation of Employee that overloads the fire method to dispatch missiles.
The point being, someMethod is doing some job that you want it to do. It is incredibly unlikely to simultaneously start doing a completely different job, while also returning something of the same shape.
- breadwinner 3y ago> an implementation of Employee that overloads the fire method to dispatch missiles If you intentionally break it, that's on you. > It is incredibly unlikely to simultaneously start doing a completely different job, while also returning something of the same shape. But it doesn't need to return something of the same shape! The shape is not being checked. All the compiler checks is for the existence of a single method of the same name. You call that type checking?
- deleted 3y ago[deleted]
- nemetroid 3y ago> > an implementation of Employee that overloads the fire method to dispatch missiles > If you intentionally break it, that's on you. The shape is not being checked. All the compiler checks is for the existence of a single class of the same name. You call that type checking?