D
dcipher
I'm in the process of rewritting my graphics library to be purely OO using
C++.
The following is a section of my heirarchy of classes:
PImage // defines all basic graphics routines as virtual functions
PImage8 // implements those routines for 8bpp
PImage15 // and for 15bpp
PImage16 // and 16bpp
PImage24 // and so on...
PImage32
What I would now like to do is define even more specific classes such as
X11Image, but instead of having to define X11Image8 ... X11Image32, I'm
wondering if it's possible to do something like the following:
class X11Image : public PImage {
X11Image() {
switch(bpp) {
case 8:
// set all virtual methods to those of PImage8, eg:
// putPixel = &PImage8:utPixel
// this doesn't work, however... is there a way to do this?
break;
case 15:
// set all virtual methods to those of PImage15
break;
// and so on...!
}
}
}
Thanks a lot,
Jeff
PS: Any suggestions are greatly appreciated here!
C++.
The following is a section of my heirarchy of classes:
PImage // defines all basic graphics routines as virtual functions
PImage8 // implements those routines for 8bpp
PImage15 // and for 15bpp
PImage16 // and 16bpp
PImage24 // and so on...
PImage32
What I would now like to do is define even more specific classes such as
X11Image, but instead of having to define X11Image8 ... X11Image32, I'm
wondering if it's possible to do something like the following:
class X11Image : public PImage {
X11Image() {
switch(bpp) {
case 8:
// set all virtual methods to those of PImage8, eg:
// putPixel = &PImage8:utPixel
// this doesn't work, however... is there a way to do this?
break;
case 15:
// set all virtual methods to those of PImage15
break;
// and so on...!
}
}
}
Thanks a lot,
Jeff
PS: Any suggestions are greatly appreciated here!