OOP - How to demand derived classes to set a value to base attribute?

Viewed 61

The output of my program is a table in a file.

Some users like the output as Excel file, the others prefer CSV, and so on.
I therefore have an abstarct class Document with 2 derived classes:
ExcelDocument and CsvDocument.

The delimiter between the output results is different in each class:
In the CSV file the delimiter is , and in the Excel the delimiter is /t.

How can I force the derived classes to set value to the delimiter attribute of the abstract Document class?

1 Answers
Related