LAB
Estimated time
20 minutes
Level of difficulty
Easy
Objectives
- improving the student's skills in operating with multiple inheritance;
- pointing out the nature of multiple inheritance problems.
Scenario
- Your task is to build a multifunction device (MFD) class consisting of methods responsible for document scanning, printing, and sending via fax.
- The methods are delivered by the following classes:
scan(), delivered by theScannerclass;print(), delivered by thePrinterclass;send()andprint(), delivered by theFaxclass.- Each method should print a message indicating its purpose and origin, like:
- 'print() method from Printer class'
- 'send() method from Fax class'
- create an
MFD_SPFclass ('SPF' means 'Scanner', 'Printer', 'Fax'), then instantiate it; - create an
MFD_SFPclass ('SFP' means 'Scanner', 'Fax', 'Printer'), then instantiate it; - on each object call the methods:
scan(),print(),send(); - observe the output differences. Was the
Printerclass utilized each time?