I am trying to understand the Closed Graph Theorem and so I would like to see an example of an unbounded linear operator $\hat{T}: \mathscr{D}(\hat{T})\rightarrow Y$ where $\mathscr{D}(\hat{T})\subset X$ is a closed domain and $X$ and $Y$ are Banach spaces. In the Closed Graph theorem the domain $\mathscr{D}(\hat{T})$ and the graph $\mathscr{G}(\hat{T})$ must be closed and so I would like to see the necessity of $\mathscr{G}(\hat{T})$ being closed. The main doubt I have is if an unbounded linear operator is allowed to be defined in a closed domain.
Thanks.