I have a class that has a function which create a different class
eg:
class:
{
class()
createImage()
modifyImage()
...
private:
...
}
createImage()
{
image Image();
}
modifyImage()
{
image.change();
}
hope you understand :P
would that work?
btw i'm using C++
Showing stuff without context makes it hard to give a good answer here. Why not just use the Image class directly? If you want to have a class that can create other classes you may want to google the Factory design pattern.
==========
Andrew
==========
Andrew
Well the code you posted wouldn't exactly work, but what you're thinking of is called a factory pattern.
etc.
public class Factory{ ... Widget * createWidget() { return new Widget(); } AnotherWidget * createAnotherWidget() { return new AnotherWidget(); }};
etc.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement