I'm not sure either but would it be a class that is instantiated only via its factory method(s) ? Pho
Regards,
Pho
John Warland
Greenhorn
Joined: Jul 11, 2001
Posts: 3
posted
0
The idea of a factory class is that it is a class which will create an object for you when you request one. They are most useful when you want to create lots of similar objects. so for example, normally you would type myObject1 = new Object(10, 1); myObject2 = new Object(10, 2); myObject3 = new Object(10, 3); to create series of objects which are similar. Instead you could just call a method in your factory class like: myObject1 = myFactClass.giveMeAnother(1); myObject2 = myFactClass.giveMeAnother(2); and method giveMeAnother would be something like public Object giveMeAnother(int val) { Object newObject = new Object(10, val); return newObject; } Basically the idea is to give you more control over the creation of your objects. So for example if you wanted to change the default value 10 to something else then you would only have to do it in one place.
Daniel Sie
Greenhorn
Joined: Aug 13, 2001
Posts: 7
posted
0
Thanks John!!! It looks similar to an Array List to me.