代写C++代码 代做C++程序 C++辅导 C++教学

C++网络家教 远程写代码 在线Debug 讲解答疑 不是中介,本人直接写

微信: ittutor QQ: 14061936 Email: ittutor@qq.com

导航

1.       Answer each of the following questions about the application:

a)       Why did the author of the software decide to create a Price class and its sub classes: RegularPrice and ChildrenPrice instead of creating subclasses RegularMovie and ChildrenMovie of the Movie class.


Because the types of movie are unchangeable,and they are less than the types of price.So it's easier to create Price class and it's sub class, and set Price as member variable of Movie


b)      Notice that the author of the Price class has chosen to make the getCharges method abstract and provided implementation for the getFrequentRenterPoints method. Why do you think this is a good choice?


Because in sub class , getCharges method are different from each other ,So parent class has no need to implement it.But the getFrequentRenterPoints method is the same in RegularPrice and ChildrenPrice.Parent class implements it and only it's sub class ChildrenPrice need to override it.


2.       Describe what you learned doing this lab.  Explain what was difficult and what was easy.


I learned how to design different by using inherit and abstract class .

I think it's easy to design a class ,however it's difficult to make them work well together.


相关推荐