RGBImageStudent::RGBImageStudent(const RGBImageStudent &other) : RGBImage(other.getWidth(), other.getHeight()), pixelMap(nullptr) { const int SIZE = other.getSize(); if (SIZE > 0) { pixelMap = new RGB[SIZE]; for (int i = 0; i < SIZE; i++) { pixelMap[i] = other.getPixel(i); } } }
void RGBImageStudent::set(const RGBImageStudent &other) { const int SIZE = other.getSize(); RGBImage::set(other.getWidth(), other.getHeight()); if (SIZE > 0) { delete[] pixelMap; pixelMap = new RGB[SIZE]; for (int i = 0; i < SIZE; i++) { pixelMap[i] = other.getPixel(i); } } }