Instead of inheritance, I would use composition here. Create a property: ExpenseExtension of an interface of type IExpenseExtension in the base class.
For expense types that have additional properties / methods, they inherit from IExpenseExtension and add additional properties / methods as needed. In the case of TravelExpense, it will have the TravelExpenseExtension class, which inherits from IExpenseExtension the additional properties / methods that you need.
In the base class, create an instance of the corresponding ExpenseExtension class based on the ExpenseType property.
Using composition instead of inheritance here will make it more flexible.
I also suggest that you create an enumeration with all types and use it for the ExpenseType property.
Check below Url to read about composition and inheritance:
http://lostechies.com/chadmyers/2010/02/13/composition-versus-inheritance/
From the link: Approving object composition over class inheritance helps keep each class encapsulated and focused on one task. Your classes and class hierarchies will remain small and less likely to turn into uncontrollable monsters.
UPDATE: The following is an example of C # code:
public class Expense { public string Food { get; set; } public ExpenseType Type { get; set; } private IExpenseExtension expenseExtension; public IExpenseExtension ExpenseExtension { get { if(expenseExtension == null) {
source share