33,311
社区成员
发帖
与我相关
我的任务
分享
#include<iostream> using namespace std class aClass {public: aClass () {total++; } ~aClass() {total--; } int gettotal() {return total; }private: static int total }; int aClass::total=0; int main() {aClass o1,o2,o3; cout<<o1.gettotal()<<"objects in existe\n"; aClass*p; if(!p) {cout<<"Allocation error\n"; return 1; } cout<<o1.gettotal(); cout<<“objects in existence after allocation\n"; delete p; cout<<o1.getttotal(); cout<<"objectd in existence after deletion\n"; return 0: } 调试时出现错误:1个无法解析的外部命令