Object Oriented Programming using C#
Case Study
However in this case there are no unique features of an ordinary message – messages have an associated cost, the cost
and text can be obtained and new messages can be created. All this is true for urgent messages. An urgent message is just
the same as an ordinary message where the text and the cost have been changed slightly. Thus UrgentMessage is a type of
Message and can inherit ALL of the features of Message with the cost and text methods being overridden.
Thus the Message and UrgentMessage classes are be related as shown below, with UrgentMessage inheriting all of the
values and methods associated with Message but overriding GetCost() and GetText() methods to reflect the different cost
and text associated with urgent messages.
A revised class diagram is below. But how will this change impact upon other parts of the system?