Sinu  Joseph

Sinu Joseph

  • NA
  • 136
  • 67.2k

oops overriding

May 26 2013 10:17 AM
create a base class, telephone and derive a class electronicphone from it.in telephone,create a protected string member phonetype,and a public method ring() that outputs a text message like this:"ringing the <phonetype>:. in electronmicphone the constructor should set the phonetype to "digital" in the run () method , call ring() on the electronicphone to test the inheritance

a) the derived class override the ring() method to display a different message

b) change the telephone class to abstract and make ring() an abstract method . derive two new classes from telephone : digitalphone and talkingphone. each derived class should set the phonetype and override the ring() method.

Answers (2)