An Ostrowski type inequality for convex functions defined on linear spaces is generalised. Some inequalities which improve the Hermite–Hadamard type inequality for convex functions defined on linear spaces are derived using the obtained result. The results in normed linear spaces are used to obtain some inequalities which are related to the given norm and associated semi-inner products, and to prove the sharpness of the constants in those inequalities.