Hi im trying to learn polymorphism and i stumbled upon a question. Polymorphism to me means 1 with many forms.
here is my code:

// virtual members
#include <iostream>
using namespace std;

class CPolygon {
    int width, height;
    void display();
    virtual string area ()
      { return ("FIRST"); }

class CRectangle: public CPolygon {
    string area ()
      { return ("SECOND"); }

void CPolygon::display(){

int main () {
  CRectangle rect;
  CPolygon poly;
  CPolygon * p1 = &rect;
  CPolygon * p3 = &poly;

  return 0;

basically it displays FIRST. I would like to add code to change it to display SECOND. How would i do so? any help is appreciated. i already did p1->area and such in the main code. This is me trying to learn it in a class code.

This question has already been answered. Start a new discussion instead.