For example, I'm creating a class of say pixel. This pixel could be part of a grey scale image that has 256 shades from black to white so it could be represented by an unsigned char. But what if I wanted a 16 bit representation?
How would I specify this in the class definition or is this even possible?
If what you want is to have a generic Pixel type... I suppose it can be done, but it doesn't make a lot of sense, if you ask me. You wouldn't have a bitmap where some pixels are one bit-depth and other pixels are another.
Manipulating individual pixels is also terribly inefficient.
I'm in a digital image processing graduate course. We can't use any image libraries. So say when I'm overlaying one image into another, I'm writing 3 unsigned chars (RGB) into the pixel location of background image receiving the overlay. With a pixel type, I could just assign the overlaid pixel to the background location.