*Disclaimer*: Feel free to downvote or vote to close, if this is again trivial (I seem to have a [bad day](https://mathoverflow.net/questions/286792/is-textcont-mathbbr-mathbbr-dense-in-mathbbr-mathbbr) today; I promise that if this is again a bummer question, I will wait $\geq 1$ day before asking new questions).


For any space $(X,\tau)$, let $\text{Cont}(X,X)$ denote the set of continuous self-maps of $X$ and let $X^X$ denote the set of all self-maps of $X$, endowed with the product topology. 


What is an example of a connected $T\_2$-space $(X,\tau)$ such that $\text{Cont}(X,X)$ is not dense in $X^X$?



Connected $T_2$-space with $\text{Cont}(X,X)$ not dense in $X^X$
Pick $X$ such that there are path-components $Y \neq Z$, and $y \in Y$, $z\in Z$ with the conditions: $y$ belongs to the interior of $Y$, $z$ belongs to the interior of $Z$, and $Y$ is not a singleton.


Choose $x\in Y\smallsetminus\{y\}$.
Then we can't approach with continuous maps a map mapping $x \mapsto z$ and $y \mapsto y$. Indeed, a map close enough should map $y \mapsto y'$, $x \mapsto z'$ with $y'\in Y$, $z'\in Z$. The image of a path joining $x$ to $y$ would thus join $y'$ to $z'$, contradiction.


Now it's easy to find a compact connected subset of the plane with these conditions. For instance, the closure of the graph $W$ of the function $[-1,1]\smallsetminus\{0\}\to [-1,1]$ mapping $x\neq 0$ to $\sin(\pi/x)$, which is connected with 3 path-components (the two connected components of $W$, and the segment $\{0\}\times [-1,1]$), with $y=(-1,0)$, $z=(1,0)$.


