Two-way radios have a limited number of channels available based on the frequencies assigned by the FCC, so there is always a chance someone else may be using the same channel you are using. This is the reason for privacy codes.
Privacy codes are based on the CTCSS or DCS codes capability of two-way radios. A receiving radio that has a privacy code set will not un-mute its speaker unless that code is sent along with a transmission.
So if a receiving radio is set to channel 2 and privacy code 5. The transmitting radio must be set to the same channel and code. This way you will be able to communicate between two radios without interference. You can also have a select group set to the same channel and code to effectively communicate with a group of users at the same time.
But, it should be understood that the privacy codes, as such, do not ensure privacy of your conversation. If any unknown user tunes in to the same channel and code that you are using, he or she can listen to the conversation taking place. So, the privacy codes feature should be looked at more as a interference eliminator rather than a feature that provides privacy of conversation.
One of the downsides of privacy codes is that you could assume that since you do not hear any communication on your radio, the channel is not being used. Then when you press the Talk button on your radio and start talking, you will be talking over the person who is already transmitting. If this occurs all transmissions for all radios will be garbled. Most 2-way radios have a Monitor button that disables the privacy code feature while the button is pressed so you can hear if there is any activity on the channel before you transmit.