/* Change: * - Global for loop variable instantiations * - See below for others */ int main() { // Changed number of records, only 4 const int NUM = 4; // Declare new paintings Painting pictures[NUM]; for(int i = 0; i < NUM; ++i) { // Declare new instance Painting temp; // Set the data temp.setData(); // Check if it is famous (to increase cost) if(isPaintingFamous(temp)) { // Create a Famous painting FamousPainting tempFamous(temp.getTitle(), temp.getArtist()); // Copy to the temporary class, default contructor should be fine temp = tempFamous; } // Added array index pictures[i] = temp; } // Cleaned up for loop for (int i = 0; i < NUM; i++) // Added index pictures[i].showPainting(); // Return for main function return 0; }