1 / 10

Speaker : Wei-Lu Lin

Concept of C++ and MFC. Speaker : Wei-Lu Lin. Advisor : Ku-Yaw Chang. Outline. Instance and Instantiation Constructor vs. Destructor Malloc /Free vs. New/Delete Data Exchange and Data Vaidation. Instance and Instantiation. Instance

Télécharger la présentation

Speaker : Wei-Lu Lin

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Conceptof C++ and MFC Speaker: Wei-Lu Lin Advisor : Ku-Yaw Chang

  2. Outline • Instance and Instantiation • Constructor vs. Destructor • Malloc/Free vs. New/Delete • Data Exchange and Data Vaidation

  3. Instance and Instantiation • Instance • An individual object of a certain class. While a class is just the type definition, an actual usage of a class is called an "instance". Instantiation iPhonedesign drawing Factory iPhones

  4. Instance and Instantiation • Instantiation • it is when you create an instance of a variable • For example: • inti ; • int *pInt =new int;

  5. Constructor vs. Destructor • Constructor • a special function • is invoked when the object is created • can be a lot of constructors • name has to be as class name • Class Time{ Public: Time() {cout<<“正在執行Time建構函式”}; } ;-> Time object_1; When you create a object_1 , the constructor will be invoked .

  6. Constructor vs. Destructor • Destructor • a special function • is called when a object is destroyed • just a destructor • “~”+ class name • Class Time{ Public: Time() {cout<<“正在執行Time建構函式”}; ~Time() {cout<<“正在執行Time解構函式”}; } ; -> Time object_1;

  7. Constructor vs. Destructor • If you don’t use the object_1, then the destructor will be called after you create object_1.

  8. New/Deletevs. Malloc/Free • New/Delete • belong to C++ • new =malloc+constructor ; delete=free+destructor • Ex: int *p=new int[10] ; delete[ ] p; • Malloc/Free • belong to C • malloc / free • Ex: int *p=(int*) malloc (10*sizeof(int)) ; free(p);

  9. Data Exchange and Data Validation • DDX • 將使用者設定於DialogBox控制項的資料,與程式內所對應的Dialog Box物件之屬性,進行資料交換。 • DDV • 檢查由使用者輸入至Dialog Box控制項內的資料是否正確,若違反檢查規則,則自動顯示警告訊息方塊。

  10. The End

More Related