0

I have a problem

class Polygon 
{
    private:
        Vertex* vertices;
        int numVerts;
        static int RefCount;

    public:
        //Constructors
        Polygon(Vertex vert[], int numVerts){
            vertices = vert;
            this->numVerts = numVerts;
        }
        Polygon() {
            vertices = 0;
            numVerts = 0;
        }
        ~Polygon() {

        }
        ReleasePolygon()
        {
            if (RefCount == 0)
                delete this; // <-------- is this line ok?
            else
                RefCount--;
        }
}

Is this a proper way of calling the destructor at this point?

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
Chanakya.sun
  • 579
  • 1
  • 5
  • 13

0 Answers0