If you're thinking you've entered Africa from Europe by flying to CAI, welcome to the unique definitions of the globe in the eyes of the airlines. As noted above, CAI is in Europe (along with such far-flung places as DXB) and so long as you haven't used up all your European segments (and remember the limit of no more than two segments to and from a place "far" from London) you can do what you suggest.
If you have segments but have used your two long trips, you can do CAI-MAD-LHR. MAD-LHR is cheap if you need to pay for it separately.
Otherwise, if you've included Africa in your trip, of course there's JNB-HKG on CX.
You're quite right if you were worrying about re-entering Europe from Africa. With a couple of exceptions that wouldn't be allowed, even in transit to HKG. Very inconsistent rules, but that's the way it is.