Answer:
Most likely Cairo, Maybe Lagos, possibly Kinshasa, in very specific circumstances Johannesburg
Step-by-step explanation:
There are 4 answers I'd find acceptable. The first being the most accepted answer and the answer you may be looking for Cairo. Cairo has a pretty large metropolitain area engulfing surrounding cities such as Giza which itself has a massive population. The second most accepted answer would be Lagos. Lagos has a large area for its own city limits and the metropolitain area is almost entirely in the actual city of Lagos. Now we're getting to the iffy canidates but the Kinshasa-Brazzaville metropolitain area is pretty dense and if your definitions are particularly strict you could say Kinshasa is the largest city in Africa. Lastly we have Johannesburg, if you have a specifically loose rationalization of where a city ends in a way you can include Pretoria (maybe you think the largest city in the country and the neighboring city where the judicial capital is should be categorized as the same city) but strict in a way that doesn't allow the other cities on this list to surpass it (such as Giza having it's own history and you find the distinction to be important, not counting Lagos's city limits as Lagos because the outskirts aren't urban enough, and not counting Brazzaville in Kinshasa's metro).