At first the government bulldozed the shanties, saying that the occupants were illegal squatters. So now the shanties are tolerated, but they have no legal right to exist. Obviously, a civilized South African government would repeal the Group Areas Act and let people live wherever they want to live. But the incentives of privatization and property rights can work even in the interstices of freedom overlooked by a repressive government. In many ways, China is one big Soweto.
Housing is owned and allocated by the government.
Not surprisingly, the housing stock is old, over crowded, dirty, and in disrepair. One gets the impression that little has been built and nothing has been washed since the Communist takeover in 1949. Once again, the market works at the edges. Because of the de facto privatization of agricultural land, rural Chinese are more prosperous than city dwellers. I was told that two million people come into Shanghai every day to shop, and the tourist on Nanjing Road or in No. 1 Department Store wouldn't doubt it.