This is a classic example used in evolution however is used only to explain differences between Lamarckian theory and Darwinian theory, nonetheless with recent tools can be explained in more detail.
Classically is proposed a population of giraffe with certain variations in neck length, this is given by genetics and alleles, all populations possess a certain pool of variation, now according to Darwin the giraffes with longer necks were selected as their fitness survival was increased due to this trait, Giraffes with longer necks could access to more vegetation and nourish better, in consequence, reproduced more than those of short neck, also when competing intraspecifically among giraffes those with longer necks were better competitors increasing also their survival rate, in time giraffes with short neck were extinguished and selective pressure continue favoring those of long neck, this in genetics meant the fixation of the allele of long neck and an increase in the frequency of the same.