In the differential equation $\frac{dy}{y}=\frac{2dx}{x}$, taking the antiderivatives gives $\ln |y|=2\ln |x|+c$, and exponentiation gives $|y|=e^c x^2$, and we could write this as $|y|=ax^2$ ($a \in \mathbb{R}$). There are, however, many other functions $y=f(x)$ that satisfy $|y|=ax^2$ aside from the standard $y=cx^2$, since we are allowed to have piecewise function. 

The restriction that $y=f(x)$ has to be continuous implies that the constant has to be equal for all $y \geq 0$ and all $y \leq 0$, but there does not seem to be a problem with a piecewise solution, $y=c\_1 x^2$ for $x > 0$ and $y=c\_2 x^2$ for $x < 0$ (with y=0 for x=0). This is because the differential equation would be true over both $x>0$ and $x<0$, and for $x=0$, the derivative would be $0$ (by taking both right-hand and left-hand limits). However, the solution says $y=cx^2$ for $c \in \mathbb{R}$, without giving any mention to piecewise function. 

Am I missing something here? Are piecewise functions (as described) actually allowed?