Why does it makes sense to define ideal gas specific heat only when heat can be written as the variation of a state function of temperature only?

I found on textbook the following comment about ideal gas specific heat.

The definition of ideal gas specfic heat: $$c=\frac{1}{n} \frac{dQ}{dT}$$ makes sense only if the heat exchanged by the gas can be written ad the variation of a state function that is only a function of temperature.

Indeed for an ideal gas, one defines $c_v$ (at constant $V$) and $c_p$ (at constant $p$), where, rispectively, in isochoric and isobaric process we have $Q=\Delta U(T)$ or $Q=\Delta H(T)$ so

$$c_v=\frac{1}{n} \frac{dU(T)}{dT} \,\,\,\, \mathrm{and} \,\,\,\,\, c_p=\frac{1}{n} \frac{dH(T)}{dT}$$

Nevertheless I do not get the theoretical reason why it would not make sense to define $c$ even when $Q$ is not a state function of temperature only. What are the reasons for saying that?

In freshman physics, we learned that, when heat is added to a constant volume system, we can write Q = CΔT, where C is called the heat capacity. However, when we got more deeply into the basics and learned thermodynamics, we found that this elementary approach is no longer adequate (or precise). We found that Q depends on process path and that, if work W is occurring, this changes things. However, we still wanted C to continue to represent a physical property of the material being processed, and not to depend on process path or whether work is occurring. This is dealt with in thermodynamics by changing the definition of C a little. Rather than associating C with the path dependent heat Q, in thermodynamics, we associate C with parameters relating to the state of the material being processed, in particular internal energy U and enthalpy H. We define the heat capacity at constant volume $C_v$ as the derivative of the internal energy U with respect to temperature at constant volume: $$C_v=\left(\frac{\partial U}{\partial T}\right)_v\tag{1}$$ We also found that we could define a heat capacity at constant pressure $C_p$ as the derivative of the enthalpy H with resepct to temperature at constant pressure:$$C_p=\left(\frac{\partial H}{\partial T}\right)_p\tag{2}$$ The question is, "do either of these definitions reduce to the more elementary version from freshman physics under any circumstances." The answer is "yes." From the first law of thermodynamics, we find that, for a closed system of constant volume (no work being done), $Q=\Delta U=C_v\Delta T$, and, for a closed system experiencing a constant pressure change (with $W=p\Delta v$), $Q=\Delta H=C_p\Delta T$. Of course, Eqns. 1 and 2 are much more generally applicable than this.