0

我有个问题

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--;
        }
}

这是此时调用析构函数的正确方法吗?

4

0 回答 0