Monkey patching I guess is similar to overriding, but when you monkey patch something it typically means that you don't change the API or access to it in any way. For example (in psuedo code) lets say we wanted to change a to_int method on a built in String object to print what it is converting to the console (really silly contrived example, but it will serve this purpose):
class MyString extends String {
function to_int() {
print(this)
return super.to_int()
}
}
Here we've provided our own to_int method, but we've changed how it is accessed - now we need to create new instances of MyString rather than String to access it.
String.old_to_int = String.to_int
String.to_int = function() {
print(this)
return this.old_to_int()
}
This time we've not changed the interface or access to the method, and across the application wherever the built in String's to_int method is called, ours will be called instead. This is the basis of monkey patching :)