4. Given the quadratic equation in $x$, $x^{2}-2(p+1)$ - $x+p^{2}+8=0$, the absolute value of the difference of its roots is 2. Then the value of $p$ is ( ).
(A) 2
(B) 4
(C) 6
(D) 8
4. $\mathrm{B}$ (Hint: $\left(x_{1}-x_{2}\right)^{2}$ $=\left(x_{1}+x_{2}\right)^{2}-4 x_{1} x_{2}$, then apply Vieta's formulas. )