Create a base class, cell phone and derive a class smartphone from it. In cell phone, create protected string member category, and a public method ringing() that outputs a text message like this: "ringing the < category >”. In smartphone the constructor should set the category to " Smart ". In the run() method, call ringing() on the smartphone to test the inheritance. a) Extent Q2 override the ringing() method in smartphone class to display a different message. b) Change the cell phone class to abstract, and make ringing() an abstract method . Derive three new classes from cell phone: android phone, windows phone and ios phone. Each derived class should set the category and override the ringing() method.
Create a base class, cell phone and derive a class smartphone from it. In cell phone, create protected string member category, and a public method ringing() that outputs a text message like this: "ringing the < category >”. In smartphone the constructor should set the category to " Smart ". In the run() method, call ringing() on the smartphone to test the inheritance.
a) Extent Q2 override the ringing() method in smartphone class to display a different message.
b) Change the cell phone class to abstract, and make ringing() an abstract method . Derive three new classes from cell phone: android phone, windows phone and ios phone. Each derived class should set the category and override the ringing() method.
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 1 images