title: g++ gives the warning message deleting array in virtual destructor, what does this mean?
body: <p>I have a class Room that inherits from an abstract class MapSite. The destructor for Room looks like this:</p>
  
  <pre><code>Room::~Room()
  {
    delete[] sides;
  }
  </code></pre>
  
  <p>MapSites's destructor is just this:</p>
  
  <pre><code>virtual ~MapSite() {}
  </code></pre>
  
  <p>The constructor looks like this:</p>
  
  <pre><code>Room::Room() : inventory(new Inventory) 
  {
    for(size_t i = 0; i &lt; 5; i++)
      sides[i] == nullptr;
  }
  </code></pre>
  
  <p>the private members of room looks like this:</p>
  
  <pre><code>private:
    int roomNumber = INVALID_ROOM_NUMBER; // Room number
    MapSite *sides[5]; // Room roof/floor/wall/exits
    std::string name; // Name of room
    std::string description; // Room description
    std::string lookDescription; // Extra description shown on look command
    std::string filename = INVALID_ROOM_FILENAME; // Lua file associated with room
    bool visited = false;
    std::unique_ptr&lt;Inventory&gt; inventory;
  </code></pre>
  
  <p>And I am getting the warning:</p>
  
  <pre><code>room.cxx: In destructor ‘virtual Room::~Room()’:
  room.cxx:45:12: warning: deleting array ‘((Room*)this)-&gt;Room::sides’ [enabled by default]
     delete[] sides;
  </code></pre>
  
  <p><strong>Could someone please explain to me what this warning means?</strong> And should/how can I suppress it?I couldn't find anything from a quick google search.Thanks!</p>