G
Guch Wu
I want to design an image processing class as follow:
class Image
{
Image Data;
General Image Operations;
read(filename, File_Type);
write(filename, File_Type);
};
The Image Data is initialized by the read function according to the
File_Type, and save to a file by write function according to the File
Type.
The problem is:
Whenever adding a file type, I have to add two functions(read and
write) to the class Image.
I want to know if there is a design pattern which bring less
modification to the class Image when adding a file type.
Any suggestion will be appreciated!
class Image
{
Image Data;
General Image Operations;
read(filename, File_Type);
write(filename, File_Type);
};
The Image Data is initialized by the read function according to the
File_Type, and save to a file by write function according to the File
Type.
The problem is:
Whenever adding a file type, I have to add two functions(read and
write) to the class Image.
I want to know if there is a design pattern which bring less
modification to the class Image when adding a file type.
Any suggestion will be appreciated!