I have enum classes that represent an accounting transaction type e.g.
enum class Liability
{
mortgage, creditors, overdraft, short_term_loans
};
enum class Income
{
sales, interest, rent, bad_debts_recovered, surplus, sundry
};
I have another one for expense, asset etc.
I need to make a class that represents a single transaction. Accounting principles in mind, a single transaction consists of two transaction types e.g. an asset and a liability, or an asset and an expense.
How can I design my Transaction class so that it only needs to store two of variables representing these types above, but can be used for any of my designated enum classes? Or is there a better way to design this scenario?
Edit: I have figured out that I might be able to template the Transaction class having the two enums as the different types. My question is - how could I statically assert that the template type is of one of my enum class types?