This is an example of innate behaviour. Instinct dictates the behaviours necessary for survival, especially in species that don't get much guidance from their parents. These behaviours are programmed into an animal at a genetic level. Innate behaviour is inheritable, passing from generation to generation through genes. The difference between an innate behaviour and a learned one is that innate behaviours are those an animal will engage in from birth without any intervention.