The polarity is a vector quantity. The resultant of the polarity
of bonds determines the polarity of the molecule. In CO2 there is
polarity between the two C-O but the polarity is equal and opposite
in direction so CO2 doesn't have polarity. If the polarity of bonds
is not cancelled then the polarity remains in the molecule.