From the Mishna in Eruvin, it's clear that if a bunch of houses are in an enclosed courtyard, the courtyard is technically one big resuht hayachid -- private domain -- but because it looks like a public space, the rabbis require an eruv chatzerot whereby all residents of the courtyard have some communal food in which they can partake, thus reminding people of its "private" nature.
With regards to apartments within an apartment building (assuming there is no broader community eruv), I've heard one (Manhattan-born) rabbi state that the same is true, the people of the apartment need to get together and form an eruv chatzerot before they can carry between apartments in the building. Does everyone agree to this? Which halachic authorities have said such (or differed with it)?