Speaking from experience, as I am now an I1 (instructor)-rated controller in VATSIM. There must be some short of a system that simulates electronic radar hand offs from one facility to the other.
Just try to imagine having an airport with TMA control split into 3 sections: Delivery, Tower, Departure/Approach.
Obviously, for departing aircraft delivery would assign a squawk code. Without some kind of squawk code allocation system based off position files or a hand off system... A new squawk code would have to be assigned again by the Tower (although not required since it's not a radar-equiped position) and then again by Departure. Of course, as the aircraft passes through the low and high sectors of each enroute facility it would have to be assigned a new squawk code EVERY time.
ludomotico wrote:I don't know about large airliners, but my squawk code on general aviation aircrafts is changed often when I enter a controlled region. This is about twice or three times an hour inside the same European country.
I guess you are referring to when you exit a CTR (Control Zone) and go uncontrolled without talking to anyone and squawking 7000 until you enter another CTR where you will be assigned a new code? Which is obviously normal since 7000 is non-discrete and cannot be used by ATC.
A different reason that you may be required to change your squawk code is when you get handed off from one ATC to the other, the new facility may require controllers to assign a new squawk code for aircraft coming from certain regions (That's why there is squawk code allocation).
In the United States, aircraft that travel through numerous enroute center sectors may often lose their assigned squawk code, which means that the assigned squawk code refreshes to "0000" and the controller loses some information on the aircraft's data tag. When that is observed, the controller may re-assign a squawk code using the phrase "Reset transponder, squawk xxxx".