note
Anonymous Monk
<p>
(In any programming language ...) This is a great place to use <i>classes.</i> The image-handling operations are defined by what (in other languages) would be called an "abstract parent-class" which defines how the rest of the application sees it. Then, for each actual implementation, you have a "concrete" child class that inherits from the parent and implements all of its methods.
</p><p>
It is also common practice to build a "factory" which, given various appropriate parameters to describe the input that is to be handled, automatically returns a child object of the appropriate concrete class. The rest of the application, therefore, doesn't have to care. It simply treats the returned object as though it were the abstract parent.
</p>
11104598
11104598
4