?? f0911.cpp
字號:
//=====================================
// f0911.cpp
// constructing object demanding extra memory
//=====================================
#include<iostream>
using namespace std;
//-------------------------------------
class Person{
char* pName;
public:
Person(char* pN="noName"){
cout<<"Constructing "<<pN<<"\n";
pName = new char[strlen(pN)+1];
if(pName) strcpy(pName,pN);
}
~Person(){
cout <<"Destructing "<<pName<<"\n";
delete[] pName;
}
};//-----------------------------------
int main(){
Person p1("Randy");
Person p2;
}//====================================
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -