Define a class File
with a method open()
. Implement child classes TextFile
and CsvFile
that override the open()
method to open the file in their respective modes.
Example 1:
Input: TextFile
Output: "Opening as a text file"
Example 2:
Input: CsvFile
Output: "Opening as a CSV file"