⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newtst.cpp

📁 arm ads1.2 with crack.rar
💻 CPP
字号:
/*
 * newtst.cpp: Test code for new and delete.
 * Uses only the C library and the "new.h" functions from the cpplib.
 */

#include <stdio.h>
#include "new"

class A {
    static int nextidx;
  public:
    A() {printf("Constructed A #%d at %p\n", idx = ++nextidx, this);};
    ~A(){printf("Destroyed A #%d at %p\n", idx, this);};
    int idx;
};

int A::nextidx = 0;

int main()
{   A *a[5];
    int j;

    for (j = 0;  j < sizeof(a)/sizeof(A*);  ++j)
        a[j] = new A;

    for (j = sizeof(a)/sizeof(A*);  j > 0;  )
        --j, delete a[j];
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -