我有以下超类和子类。
我收到编译时错误:
1) Error 3 Inconsistent accessibility: parameter type 'DomainObjectModel.ObjectModel.PocoProjectData' is less accessible than method 'DomainObjectModel.ObjectModel.Project.Project(DomainObjectModel.ObjectModel.PocoProjectData)' C:\Workspace\POC\Final\oCPDSService\oCPDSService\DomainObjectModel\ObjectModel\Project.cs 19 12 DomainObjectModel
2)Error 4 Inconsistent accessibility: parameter type 'DomainObjectModel.ObjectModel.PocoProjectData' is less accessible than method 'DomainObjectModel.ObjectModel.Project.ProjectCapacity.ProjectCapacity(DomainObjectModel.ObjectModel.PocoProjectData)' C:\Workspace\POC\Final\oCPDSService\oCPDSService\DomainObjectModel\ObjectModel\Project.cs 102 14 DomainObjectModel
3) Error 5 Inconsistent accessibility: parameter type 'DomainObjectModel.ObjectModel.PocoProjectData' is less accessible than method 'DomainObjectModel.ObjectModel.Project.ProjectCIP.ProjectCIP(DomainObjectModel.ObjectModel.PocoProjectData)' C:\Workspace\POC\Final\oCPDSService\oCPDSService\DomainObjectModel\ObjectModel\Project.cs 154 14 DomainObjectModel
namespace DomainObjectModel.ObjectModel
{
public class Project
{
public Project()
{
SchedulePhases = new HashSet<SchedulePhase>();
}
public Project(PocoProjectData pocoProjectData)
{
SchedulePhases = new HashSet<SchedulePhase>();
this.AssetId = pocoProjectData.AssetID;
this.CapitalCategoryId = pocoProjectData.CapitalCategoryID;
this.ProgramCategoryId = pocoProjectData.ProgramCategoryID;
this.StatusId = 1;
this.DSFId = pocoProjectData.DsfNumber;
this.IsRollover = "N";
this.IsDeferred = "N";
this.IsApproved = "N";
this.FundingSourceId = 12;
this.IsLongTermLease = "Y";
}
[Key]
public decimal ProjectId { get; set; }
public decimal AssetId { get; set; }
public decimal CapitalCategoryId { get; set; }
public virtual ICollection<SchedulePhase> SchedulePhases { get; set; }
protected bool success = false;
public virtual bool CalculateSchedule(int projectType)
{
return success;
}
public class ProjectCapacity : Project
{
public ProjectCapacity(PocoProjectData pocoProjectData)
: base(pocoProjectData)
{
}
public override bool CalculateSchedule()
{
return success;
}
}
public class ProjectCIP : Project
{
public ProjectCIP(PocoProjectData pocoProjectData)
: base(pocoProjectData)
{
}
public override bool CalculateSchedule(int projectType)
{
return success;
}
}
}
如何从基类Project调用子类CalculateSchedule()以获取Project.SchedulePhases集合?
谢谢,
答案 0 :(得分:1)
错误说明PocoProjectData
不易访问Project
。
项目被标记为公共项目,因此PocoProjectData也必须至少是公开的。检查一下。