1 / 13

C++ Programming Practice Time

C++ Programming Practice Time. Week 6. This. Pointer for current executing instance. Practice : Static Member. Member not on instance, but on definition Share-able in all instance of same class. File Separate. Implement. Define. Practice : Friend. Please Check Professor’s Material.

Download Presentation

C++ Programming Practice Time

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. C++ Programming Practice Time Week 6.

  2. This • Pointer for current executing instance

  3. Practice : Static Member Member not on instance, but on definition Share-able in all instance of same class

  4. File Separate Implement Define

  5. Practice : Friend • Please Check Professor’s Material

  6. Practice : Operator Overloading • Overload • operator << (int Int_Val) {printf(“%d”, Int_Val;)} • operator << (const char* pCh) {printf(“%s”, pCh;)} • … • Override • Base Class function f_A • Derived Class function f_A • BaseClass *pBc = new DerivedClass(); • pBc->f_A(); //Derived Class function f_A will be called

  7. Inheritance • ex) • Room • Rm_Quiz, Rm_Dead, Rm_End

  8. Method Overriding

  9. Protected • Allowed • Inner • Derived Class • Denied • Outer • Derived’s Derived

  10. Constructor Chain • Base Class : Room • Derived Class : Rm_Dead • When Rm_Dead created. • 1) Room’s constructor called • 2) Rm_Dead’s constructor called • From Deep, To Shallow

  11. Polymorphism • Override • Base Class function f_A • Derived Class function f_A • BaseClass *pBc = new DerivedClass(); • pBc->f_A(); //Derived Class function f_A will be called • Type : BaseClass • Instance : DerivedClass

  12. Protected • Derived class will implement virtual function for its purpose

  13. The End of Week 6.

More Related