First, celebrate that the Magento framework allows you to do this. It's a cool feature!
Next you need to check that this class is not directly referenced. This includes direct instantiation (i.e. new Mage_Shipping_Model_Carrier_Tablerate
) as well as being subclassed; if any other class extends
this class then your rewrite either won't work or will work inconsistently depending on direct usage of this class.
If the class is instantiated directly, subclassed, or if you prefer not to use Magento's class rewrite mechanism, then you can copy the path and file under the app/code/local/
codepool and make your changes there. The caveat of this approach is that when you upgrade you will need to merge changes from the definition under the core codepool into your local definition.
If you want to do a proper rewrite then you need to specify the following in some configuration XML:
<global>
<models>
<shipping>
<rewrite>
<carrier>
<tablerate>Namespace_Module_Model_Shipping_Tablerate</tablerate>
</carrier>
</rewrite>
</shipping>
</models>
</global>
This configuration should be in your own module's configuration XML. The caveat here though is that if any other custom module is also trying to perform the rewrite, you will have to set a dependency and extend your rewritten class from the other module's rewriting class.