Can one define in a program to read different sensors through one pin?
Yes, you can. This kind of sensor uses a OneWire bus. This bus is designed to hold many sensors on just one signal wire (which also can act as the power wire). The sensors have addresses so you can choose in the program which one to read.