Weitere ähnliche Inhalte
Ähnlich wie Lecture 6 polymorphism (20)
Lecture 6 polymorphism
- 8. 7- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Step into the constructor !
- 10. 7- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Step into the constructor !
- 13. 7- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Which object ’s method is this going to Execute? discount . lessThan ! ( lessThan is inherited from Sale !!! )
- 14. 7- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Step into lessThan !
- 16. 7- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Step into this bill() !
- 18. 7- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Step into Sale bill() !
- 20. 7- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Returned!
- 35. 7- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Which object ’s method is this going to Execute? discount . lessThan ! ( lessThan is inherited from Sale !!! ) Which object ’s method is this going to Execute? specialPrice . equalDeals ! ( equalDeals is inherited from Sale !!! ) Step into equalDeals !
- 36. 7- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. It knows to call the bill method of the specialPrice !!!!
- 40. 8- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Call static method announcement() by using the class Sale and DiscountSale !!!! Step into Sale announcement() !
- 42. 8- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Step into DiscountSale announcement() !
- 47. 8- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Step into s . announcement() !
- 49. 8- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Step into discount . announcement() !
- 52. 8- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. It knows that discount2 is going to be a Sale object !!!!
- 54. 8- Copyright © 2010 Pearson Addison-Wesley. All rights reserved. Which announcement() will be invoked???