我是 Asp .net C# 的新手。我对对象和继承有疑问。如果我的父类(基表)有 2 个子类(信用卡表、银行账户表),我会很开心。在另一个从基表类中获取对象的类中。我的问题是我想知道基表是信用卡还是银行账户?!
class BaseTable
{
string date;
public string Date
{
get { return date; }
set { date = value; }
}
string description;
public string Description
{
get { return description; }
set { description = value; }
}
}
class CreditCardTable:BaseTable
{
string Amount;
public string amount
{
get { return Amount; }
set { Amount = value; }
}
string Type;
public string type
{
get { return Type; }
set { Type = value; }
}
}
class BankAccountTable:BaseTable
{
string Refr;
public string Ref
{
get { return Refr; }
set { Refr = value; }
}
string debit;
public string Debit
{
get { return debit; }
set { debit = value; }
}
string credit;
public string Credit
{
get { return credit; }
set { credit = value; }
}
}