I had one class that was used ConfirmNonInventoryViewModel, but then I had to come up with a different type of object, which was very similar, but with one other property (which may have more unique properties as functionality increases).
So, I wanted to turn this original class into a base class, and then create 2 derived classes to account for two unique variants of objects. But since I have code around already using the original class and I don’t want it, and therefore the developers do not use this base class directly ahead, I thought that its designation as abstractwould not allow it to be used and only derivative variants could be used like that.
But it gives me errors like Inconsistent Accessibility: base class is less accessible than derived class. Therefore, I think I misunderstood what the abstract class is used for.
How can I satisfy my requirements as described above?
public class ConfirmWorkOrderNonInventoryViewModel : ConfirmNonInventoryViewModel
{
[Display(Name = "Part:")]
public int WorkOrderDetailId { get; set; }
}
public class ConfirmShipOrderNonInventoryViewModel : ConfirmNonInventoryViewModel
{
[Display(Name = "Order:")]
public int OrderHeaderId { get; set; }
}
abstract class ConfirmNonInventoryViewModel
{
[Display(Name = "Part:")]
public int OrderDetailId { get; set; }
[Display(Name = "Material:")]
public string ItemDescription { get; set; }
[Display(Name = "Est Qty:")]
public decimal EstimatedQty { get; set; }
[Required]
[Display(Name = "Act Qty:")]
[UIHint("TextBoxFor_50w")]
public decimal? ConfirmedQty { get; set; }
}
source
share