"Overriding" is the process of replacing one method with another in child classes. What you've actually done is something called "shadowing," which is where you've hidden a system class with a custom class. The order of preferences is kind of explained in Type Resolution and System Namespace for Types:
For a type reference TypeN, the parser first looks up that type as a scalar type.
If TypeN is not found, the parser looks up locally defined types.
If TypeN still is not found, the parser looks up a class of that name.
If TypeN still is not found, the parser looks up system types such as sObjects.
In other words, the preferred order of operations is a variable name, then inner classes, then top level classes, then system classes.
Custom classes are always searched first, and can therefore shadow system classes. It is strongly recommended that you do not name variables or classes the same as system classes, because that effectively removes the ability to use that class.
There are ways to work around this shadowing in most cases, but it requires that you're willing to update every single class affected by it. It's simply a lot easier to not break things to begin with. Naming a class Test, Database, SelectOption, PageReference, Schema, Math, and so on (pretty much anything that's in the documentation that's not a reserved keyword) will break other code. Just don't do it.
To fix this, you're going to need to clear out the content of your pages (change them to just <apex:page />
, delete the offending class(es), then restore your code. The first step breaks the metadata association, while the last step obviously forces compilation.