You cannot. At least not without tricks.
To solve this, I would recommend to templatize the printPixels()
function:
template<class T> void printPixels(ImageT<T>^ img)
If you really need it, you could add a printPixels(ImageBase^ img)
that checks the type of img, casts it, and calls the right printPixels(ImageT<T>^ img)
for the real work.