I am just making sure I understand the difference between the two codes correctly.
I am creating two instances of class CRectangle but working with them as if they were instances of CPolygon.
- In the case of 'pRect' the output is 20, because in the CPolygon the function area() is declared as virtual.
- On the other hand, for 'rect' the output is 0. Is this because there is an implicit casting going on? That is 'rect' is really an instance of CPolygon?