I have a class:
internal class Stage { public long StageId { get; set; } public string StageName { get; set; } public int? Order { get; set; } public Stage() { Order = 0; } }
I also have:
public class GroupStage : Stage { private override long StageId { set { StageId = value; } } public GroupStage() : base() { } public void InsertStage(long groupId) { } public static void SetStageOrder(long stageId, int order) { .... } public static void DeleteStage(long stageId) { .... } public static GroupStage[] GetStages(long groupId) { .... } }
and
public class TaskStage : Stage { public DateTime? Time { get; set; } public TaskStage() : base() { .... } public static Stage GetNextTaskStage(Guid companyId, long taskId) { .... } public static Stage[] GetTaskStages(Guid companyId, long taskId) { .... } }
This does not work, and I get an exception: Inconsistent availability: Stage base class is less accessible than GroupStage class
I want the Stage class to be private and without access except GroupStage and TaskStage . I also want to make StageId private in GroupStage and TaskStage . How can I do this without duplicating Stage members in GroupStage and TaskStage ?
source share