Yup, that's the whole idea, of course.
to elucidate a little on Pfranz's excellent summary of rhyming slang. It grew up in C19 London (although it's roots are probably at least C18, possibly earlier) after the formation of the Metropolitan Police force in 1829 (I think the date's right - I haven't checked, but I'm not more nor a coupla yrs out, at worst!)
Many of the activities of the Cockneys were outside the law and it was necessary to use a cant so that important conversations were not understood by outsiders who happened to over hear.
In this respect, it is a bit like pidgin, only in reverse - pidgin was invented so that orders could be given to servants in a language that was not sophisticated enough to enable them to understand English as spoken by the Imperial Rulers of the pink bits of the world.