$a = Quantity->new(10, 'apple'); $b = Quantity->new(20, 'orange'); ... $c = $a + $b; # dies "Oi! you can't add apples to oranges!"