I understand the benefits of a factory design if client is not supposed to know what concrete class to create, but something like this confuses me
Factory factory = new ConcreteFactory2();//Decides which object must create.
Base obj = factory.GetObject();
If this is in the main class, then why not just say
ConcreteFactory2 factory = new ConcreteFactory2()
I could understand Factory factory = new Factory(2)
where the 2 would represent the object to return.
Is there a real purpose for having this Factory factory = new ConcreteFactory2();//Decides which object must create as the programmer needs to know which to instanciate?
Also looking at this from a factory prosepctive, I would like to hear from anyone who believes that is is better to use Abstract classes instead of interfaces. I understand that interfaces cannot pass private variables through, but I don't really need to do that.