Here is "The Pasting Lemma" from Munkres Topology 2E (p108 Theo 18.3):
Let $X = A \cup B$, where A and B are closed in X. Let $f: A \to Y \text{ and } g: B \to Y$ be continuous. If $f(x) = g(x)$ for every $x \in A \cap B$, then f and g combine to give a continuous function $h: X \to Y$, defined by setting $h(x) = f(x) \text{ if } x \in A\text{, and } h(x) = g(x)\text{ if } x \in B.$
Munkres has there an easy example with function $h: R \to R$.
But i did not come up with a more topological example. Also using google has returned no fruitful results.