Note that by definition $A$ is dense in $\operatorname{cl}(A)$, so it suffices to prove the following: if $f_1, f_2: X \to Y$ are continuous between spaces $X$ and Hausdorff $Y$, and if for a dense subset $D$ of $X$ we have that $\forall x\in D: f_1(x) = f_2(x)$, we have equality for all of $X$.
This follows from the following facts:
$\Delta_Y = \{(y,y): y \in Y\}$, the diagonal of $Y$, is closed in $Y$. This is in fact equivalent to Hausdorffness. See this answer.
$f_1 \nabla f_2: X \to Y \times Y$, defined by $(f_1 \nabla f_2)(x) = (f_1(x), f_2(x))$ is continuous, as $f_1, f_2$ are, and a map into a product is continuous iff its compositions with all the projections are continuous.
The previous two together imply that $\operatorname{Eq}(f_1,f_2) := \{x \in X: f_1(x) = f_2(x)\} = (f_1 \nabla f_2)^{-1}[\Delta_Y]$ is closed in $X$.
As $D \subset \operatorname{Eq}(f_1,f_2)$, $X = \operatorname{cl}(D) \subset \operatorname{cl}(\operatorname{Eq}(f_1,f_2)) = \operatorname{Eq}(f_1,f_2)$ as well, so $f_1$ and $f_2$ coincide on all of $X$.
As to the example, Stefan gave a fine one: $X = [0,1]$, $A = (0,1]$, $Y = \mathbb{R}$, $f: A \to Y, f(x) = \frac{1}{x}$; we cannot define $f(0)$ to get a continuous function.