I'd never heard of this until I was reading about the poet Robert Burns' home in Scotland. It's called a box-bed, and it's actually built into the wall, and attached to the ceiling. Great as a space saver in a small cottage. The box-bed at the Burns cottage was shared by the whole family (oh, my!) and was nothing like this beautiful carved one.
A box-bed is a bed enclosed in furniture that looks like a cupboard, half-opened or not.The box-bed is closed on all sides by panels of wood. One enters it by removing curtains, opening a door hinge or sliding doors on one or two slides. In front of the box-bed was often a large oaken chest, with the same length as the bed. This was the 'seat of honour,' and served also as a step for climbing into the bed. It was also used to store clothing, underwear and bedding the rest of the time