Define a class Document
with a method save()
. Implement child classes WordDocument
and PdfDocument
that override the save()
method to save the document in their respective formats.
Example 1:
Input: WordDocument
Output: "Saving as .docx file"
Example 2:
Input: PdfDocument
Output: "Saving as .pdf file"