笔记,c++中静态对象在程序结束的时候会不会进析构函数?

    xiaoxiao2025-06-16  5

    1.直接在静态存储区上放的对象会进入析构函数。

    void func() { static classA a; }

    2.在静态存储区放对象指针,而对象本身在堆上,这种形式不会进入析构函数。

    void func() { static classA* pA = new classA; }

    转载请注明原文地址: https://ju.6miu.com/read-1300013.html
    最新回复(0)