No, we do not violate.
When we tell the Factory class to instantiate an object, all responsibility lies with the Factory class. The caller does not affect a particular class.
The Factory class itself also does not violate this rule. He does what he has to do: on the basis of these rules (let it be hardcoded or installed externally or maybe something more complex) he decides which object to generate. But every bit of logic is inside the Factory method.
source share