Hong Kong and Macau are part of China, but they have their own currencies.
The official currency of Hong Kong is Hong Kong Dollar - HKD.
Macau is using Macanese pataca - MOP.
Because of that, Yuan or Renminbi may be not accepted as a currency, when making cash payments in these countries. It is better to have some domestic currency with you.