Like this article? We recommend
C# enum Types
Each document derived from has a specific type. Listing 4 illustrates the enum documentType. This definition is in fact lifted straight out of the C++ code.
Listing 4 The enum documentType
namespace Documents { enum documentType { INVOICE = 1, CONTRACT = 2, MEMO = 3, PAYSLIP = 4, TAXFORM = 5, SOCIALSEC = 6, ACCOUNTING = 7 }; public abstract class AnyOldDocument //The rest of the namespace code goes //here as in Listing 3 above
The enum is used during the construction of a derived class. Let's now take a look at how to create a C# subclass of AnyOldDocument.