I\'m trying to implement a Factory pattern in Java. I have a class called Shape which Circle and Triangle extends. The problem is that Shape constructor gets only 2 parameters w
What you are trying to do is simply impossible. If the constructor arguments are different, then the client code will have to do different work for a Circle
as for a Square
and you can't solve this with uniform code. If there is other work the factory is doing besides handling the constructor arguments that you believe should happen in a factory, then you need to post this to your question and state the difficulty you are having in factoring out this common code-work.