Create your custom block, for simplicity we'll just use the Mage namespace so we don't need to create a full module, however you should look into creating custom modules too.
app/code/local/Mage/Checkout/Block/Myblock.php
class Mage_Checkout_Block_MyBlock extends Mage_Core_Block_Template
{
public function test()
{
return 'testing';
}
}
app/design/frontend/default/default/layout/checkout.xml (use your templates config files)
<checkout_cart_index translate="label">
<!-- other code is in here.. -->
<reference name="content">
<!-- other code will be here too -->
<block type="checkout/cart_totals" name="checkout.cart.totals"
as="totals" template="checkout/cart/totals.phtml" />
<!-- Add your block in here.. -->
<block type="checkout/myblock" name="checkout.myblock"
as="myblock" template="checkout/cart/myblock.phtml" />
</reference>
</checkout_cart_index>
app/design/frontend/default/default/template/checkout/cart/myblock.phtml (or in your template custom)
<?php echo $this->test() // shows "testing" ?>
You can use your child block inside your cart block as your require
$this->getChildHtml('myblock');