我正在尝试从名为RepositoryVoucher.cs的主类访问我的RepositoryJournalVoucher.cs类的对象,但我无法访问或创建实例,不知道原因。
抽象类RepositoryUniversalAccounts.cs
namespace eCartDynamic.RepositoryApplication
{
public abstract class RepositoryUniversalAccounts
{
public string AccountCode { get; set; }
public abstract string PostVoucher();
}
}
RepositoryCashVoucher.cs
namespace eCartDynamic.RepositoryApplication
{
public class RepositoryCashVoucher : RepositoryUniversalAccounts
{
public override string PostVoucher()
{
AccountCode = "16-01-001-01-000001-CV";
return "CV Posted Sucessfully";
}
}
}
RepositoryJournalVoucher.cs
namespace eCartDynamic.RepositoryApplication
{
public class RepositoryJournalVoucher : RepositoryUniversalAccounts
{
public override string PostVoucher()
{
AccountCode = "16-01-001-01-000001-JV";
return "JV Posted Sucessfully";
}
}
}
主类。 RepositoryVoucher.cs
namespace eCartDynamic.RepositoryApplication
{
public class RepositoryVoucher
{
RepositoryUniversalAccounts abc = new RepositoryJournalVoucher();
}
}
在我的RepositoryVoucher.cs类中,我无法创建类似的对象:
RepositoryUniversalAccounts abc = new RepositoryJournalVoucher(); RepositoryJournalVoucherabc obj = new RepositoryJournalVoucher();