A domain $\Omega$ is said to admit an $L_p$-Hardy inequality if there exists a finite uniform constant $C > 0$ so that the estimate
$$\int_\Omega \frac{| f(x) |^p}{d(x)^p} dx \leq \int_\Omega | \nabla f(x) |^p dx$$
holds for all functions in W^{1,p}_0(\Omega). Here d(x) means the Euclidean distance to the boundary of the domain.
Pretty much every paper on the subject begins by saying that it suffices to prove that the inequality holds for all functions in $C^\infty_0(\Omega)$ because of the density of $C^\infty_0(\Omega)$ in $W^{1,p}_0(\Omega)$. My question is why does the density of $C^\infty_0(\Omega)$ in $W^{1,p}_0(\Omega)$ imply the above result?