I have that book, but I am still having a hard time using the pattern in it. I think that I might need some more programming experience before I can really find it useful.
Would this be a better example of a factory?
Code:
class ObjectFactory
{
public:
ObjectFactory();
ObjectA* createObjectA(const std::string *weapon = 0, const std::string *look = 0, int x = 0, int y = 0)
{
ObjectA* obj = new ObjectA();
if(look != 0)
{
if(look == "Hansome")
obj->assingPicture("data//looksVeryGood.jpeg");
else if(look == "Dog")
obj->assingPicture("data//animal//dog.png");
}
if(weapon != 0)
{
if(weapon == "Rifle") {
obj->changeWeapong(enum_rifle);
obj->setAmmo(10);
}
else if (weapon == "Handgun")
{}
}
if(x != 0 && y != 0)
{
obj->move(x,y);
}
return obj;
}
ObjectB* createObjectB();
};