C# - Is there a way to inherit from two different classes?

  • Thread starter Thread starter iHandler
  • Start date Start date
I

iHandler

Guest
I have 3 different .cs files, say

- Transaction.cs
- Account.cs
- Status.cs

What I want to do is

public class Transaction: Account, Status

And doing this will cause error since C# does not support multiple inheritance, Is there a way I can inherit from two different classes?


// Transaction.cs
public class Transaction
{
public int TransactionId { get; set; }
public DateTime TransactionDate { get; set; }
public decimal Amount { get; set; }
public string Description { get; set; }
}

// Account.cs
public class Account
{
public int AccountId { get; set; }
public string AccountName { get; set; }
public string AccountType { get; set; }
}

// Status.cs
public class Status
{
public int StatusId { get; set; }
public string StatusName { get; set; }
}

Continue reading...
 
Back
Top