I was wondering if it was possible to change the class of an object to something derived from it, and if so how would be best to do it?
For example, I have an abstract base class called polygon, and derived classes such as triangle, quadrilateral etc, which contain a vector of pairs that are the coordinates of their vertices. I would like to have a class for squares, derived from quadrilateral, but is there a way of changing an object's class from quadrilateral to square (after checking that the quadrilateral is a square of course)?
You may want to look into dynamic_cast<>(). However, what you are trying to do suggests a design flaw; if you are putting all these polygons into a list, you should treat them as polygons. If you want to handle them in special ways based on their actual type either use polymorphism or actually handle them separately.
If you need to cast to a more specific type, you aren't using polymorphism anymore. If you were using polymorphism, you would call a method on polygon that was overridden to do the proper thing for whatever type you were actually working with.