freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

指向?qū)ο蟮某V羔?ppt32)-經(jīng)營管理-在線瀏覽

2024-10-18 09:13本頁面
  

【正文】 ting ““\n”。 if(pName) strcpy(pName, )。 int main(){ Person p1(“Randy”)。 } 結(jié)果: Constructing Randy Constructing Randy Destructing Randy Destructing Randy ?自定義拷貝 /復(fù)制構(gòu)造函數(shù) 16 靜態(tài)成員 ( Static Members ) 靜態(tài)數(shù)據(jù)成員 由每個該類對象共享 , 描述此類對象的共性狀態(tài) , 是類的一部分 。 ? 一般形式: 數(shù)據(jù)類型 類名 ::靜態(tài)數(shù)據(jù)成員名=初值; ? 類體內(nèi)聲明 , 但只能在類體外進行初始化 。 17 例如: class Student{ string name。 void set(string str){ name = str。 } }。 //靜態(tài)數(shù)據(jù)成員在類外初始化 int main(){ Student s1, s2。 (“John”) 。 // 可行,非標準 coutStudent::num“\n”。 ? 作用 處理靜態(tài)數(shù)據(jù)成員; ? 一般定義形式 static 函數(shù)類型 函數(shù)名 ( 參數(shù) ) ; ? 調(diào)用形式 類名 ::函數(shù)名 ( 參數(shù) ) ; 19 ? 問題: 調(diào)用靜態(tài)成員函數(shù)時 ,不捆綁對象 ,即沒有this指針 。 ? 解決辦法 : 靜態(tài)成員函數(shù)一般設(shè)計為公有的 ,以訪問私有靜態(tài)數(shù)據(jù)成員為目的 。 // 靜態(tài)私有成員 //... public: // ... static void showNum(){ coutnum“\n”。 int Student::num = 0。 ()。 // 靜態(tài)成員函數(shù)調(diào)用 } 21 友元 ( Friends ) ? 作用 用以訪問與其有好友關(guān)系的類中的私有成員。 22 友元函數(shù) 將普通函數(shù)聲明為友元函數(shù)。 public: void set (int, int,int)。)。 void Time::set ( int h, int m, int s) {…} void display (Time amp。 } int main() { Time t1。 display(t1)。 } 若以普通函數(shù)的身份實現(xiàn) ,則要大量調(diào)用成員函數(shù)去訪問私有數(shù)據(jù)成員 , 而用友元之后 , 可以直接訪問之 。 24 友元成員函數(shù) 聲明某類的成員函數(shù)為另一類的友元函數(shù)。 25 class Date。 public: void set (int, int,int)。)。 class Date { int year,month,day。 friend voi
點擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1