Discussion of continuous functions in topology Here is the definition of continuous function that I like to go with even in topology:

Let $X$ and $Y$ be any topological spaces, let $f \colon X \rightarrow Y$ be a function, and let $p$ be a point of $X$. Then $f$ is said to be continuous at point $p$ if, for every open set $V$ of $Y$ such that $f(p) \in V$, there exists an open set $U$ of $X$ such that $p \in U$ and $f(U) \subset V$.


Let $S$ be any subset of $X$. If the function $f$ in the preceding paragraph is continuous at every point $p \in S$, then $f$ is said to be continuous on $S$.


Annd, if the function $f$ is continuous on $X$, then $f$ is simply said to be continuous.

Is my definition correct? I think satisfaction at every point of this is the definition that Munkres has shown to be equivalent to the definition of continuity in his Sec. 18.
Of course, I can show that the above definition of continuity at a point is equivalent to the one used for maps between metric spaces.
Is my approach consistent with that used in calculus and real or elementary complex analysis courses? If so, then why is it that the topology books mostly go with the definition of continuity requiring the inverse images of open sets being open?
What if we instead require that for a function $f \colon X \rightarrow Y$ to be continuous at a point $p \in X$, the inverse image $f^{-1}(V)$ is open in $X$ for every open set $V$ of $Y$ such that $f(p) \in V$? Are there any counter-examples of continuous-at-a-point real-valued functions of a real variable that fail to satisfy this condition?
PS:
Having read through the comments and the answer below, I would like to add the following to my original question:
If a function is continuous at some points of domain, it may still not be continuous on the whole domain, whereas the inverse image of open sets being open definition is that of continuity of a function on the whole domain. So is it not the more reasonable approach to first consider continuity at a point (just as in calculus and analysis courses) and then proceed to show that continuity on the whole domain occurs iff the inverse images of open sets in the co-domain space are open in the domain space?
 A: I am accustomed to seeing both definitions in topology texts. Sometimes continuity at a point is defined first, perhaps because it’s the direct topological analogue of the $\epsilon$-$\delta$ definition with which students are familiar from calculus. Sometimes global continuity is defined first, and while this is in large part a matter of pædagogical taste, I think that an even better case can be made for this approach: in general global continuity is more important and generally easier to work with. I would argue that in a purely topological setting global continuity is a more fundamental notion than continuity at a point. I’m not fond of category theory, but there’s a reason that continuous maps are the morphisms in the category of topological spaces.
At any rate, the textbooks that I have on hand (Kelley, Dugundji, Greever, Munkres (both editions), Willard, Nagata, Engelking) are roughly evenly divided between the two approaches.
For your last question, let
$$f:\Bbb R\to\Bbb R:x\mapsto\begin{cases}
x,&\text{if }x\in\Bbb Q\\
0,&\text{if }x\in\Bbb R\setminus\Bbb Q\;;
\end{cases}$$
$f$ is continuous at $0$ and nowhere else. But for any $r>0$, $$f^{-1}\big[(-r,r)\big]=(-r,r)\cup(\Bbb R\setminus\Bbb Q)\;,$$ which is not open in $\Bbb R$, so $f$ fails to satisfy your condition.
A: Your approach is absolutely correct.
Your question comes very close to Continuity of a function between two topological spaces. From a motivational (and historical) point of view I agree with you that continuity at a point is the basic concept.
This concept was introduced in the nineteenth century for functions $f : \mathbb R \to \mathbb R$ in form of the usual $\varepsilon$-$\delta$-definition, and it only works pointwise. In the beginning of the twentieth century the next level of abstraction was reached by introducing metric spaces as a generalization of the reals endowed with the usual distance-function $\lvert x - y \rvert$. Continuity is again defined pointwise via the $\varepsilon$-$\delta$-approach. The final level of abstraction was the axiomatic definition of topological spaces, but I think at the beginning continuity was introduced again pointwise. See also here.
Nevertheless, continuous functions are more interesting than non-continuous functions, and the most elegant definition of continuity is certainly that via  inverse images of open sets. This means that continuity is a global phenomenon, and individual points are not needed to describe it.
