In J. K. Rowling's Harry Potter and the Chamber of Secrets, chapter 10, we have Harry
keeping a firm hold on Dobby's wrist to stop him from hitting himself with the water jug again.…
There was a loud crack, and Harry's fist was suddenly clenched on thin air.
The loud crack, we know from elsewhere in the series, is due to Dobby's disapparition. Now, a house-elf (like Dobby) can bring a human along when he disapparates: we see this in another of the books in the series, when Dobby brings humans from Malfoy's house to the Burrow (if I recall correctly: or something like that, anyway). Moreover, such side-along apparition can work even without the consent of the one apparating: we see this in another book also, when someone lands with an Order of the Phoenix member on the step of the Order's headquarters through such apparition.
In that case, why didn't Harry go with Dobby?