1 / 66

Chapter 11. Object-Oriented Programming: Inheritance

Chapter 11. Object-Oriented Programming: Inheritance. 11.2 Base Classes and Derived Classes. “is a” . 11.3 protected Members. Overriding Methods. Overriding Methods. Keep it. change. augmented . Overriding Methods.

asta
Télécharger la présentation

Chapter 11. Object-Oriented Programming: Inheritance

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. Chapter 11.Object-Oriented Programming: Inheritance

  2. 11.2 Base Classes and Derived Classes

  3. “is a”

  4. 11.3 protectedMembers

  5. Overriding Methods

  6. Overriding Methods Keep it change augmented

  7. Overriding Methods • virtual– tells the compiler that this method CAN be overridden by derived classes • override – in the subclass, tells the compiler that this method is OVERRIDINGthe same method in the base class • base – in the subclass, calls the base class’s method

  8. Abstract Classes cont abstract class

  9. Abstract Classes cont

  10. Sealed Classes and Methods

  11. structs

  12. struct ex.

  13. interfaces

  14. Interfaces Ex

  15. 11.4.1 Creating and Using a CommissionEmployeeClass

  16. 11.4.2 Creating a BasePlusCommissionEmployee Class without Using Inheritance

  17. new

  18. new

  19. 11.4.3 Creating a CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy

  20. 11.4.4 CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using protected Instance Variables protected members public virtual decimal Earnings()

  21. OK, because they are protected

  22. 11.4.5 CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using private Instance Variables

More Related