I never remember this stuff but can you match the offer if you are over the cap?
Yes and No. You have to be able to match the offer within the constraints of the salary cap. For example, when Marc Jackson was a free agent last summer, GS was over the cap and didn't have any Bird Rights on Jackson. Therefore, the most they could offer him was the MCE (~$4.5M). If somebody else had given him an offer higher than that, then GS wouldn't have been able to match.
That being said, after 4 years, we would have full Bird Rights on Yao, so we are allowed to exceed the cap to sign him and then match any offer.