Calculating using object oriented concept