yes. There exists a type of heater that can heat a building by doing that – it is called a heat pump. It is a bit like taking a fridge and putting the cold bit of the fridge outside the building and the hot bit at the back of the fridge inside the building.
Comments