cast subclass to another subclass-Collection of common programming errors

You don’t cast classes, you cast references to instances of classes. And note that if you have an instance of one subclass and cast it to another subclass, that will cause a runtime error. You can only cast something to be something that it is (e.g., you can cast an OpenRequest as a Request, because all OpenRequests are Requests); if you try to cast it to be something that it isn’t (casting an OpenRequest as a CloseRequest, for instance), that will fail.