I want to create an abstract class in C#. Currently, I have this class in C#:
public class CreditReportViewModel
{
public Person Person { get; set; }
public DateTime ReportDate { get; set; }
public string PersonalAddress { get; set; }
public string EmployerAddress { get; set; }
}
I want to make it abstract class and two other classes will inherit it. Do I just need to place abstract keyword with class to need to change properties as well. What about classes which will inherit this class. What need to be changed in these classes?
Please suggest.
The only thing needed to make the class
abstractis to add the keyword:In this case, implementing classes do not need to add any additional implementation:
If you want to make members
abstractas well, same thing goes there:The typical case is that the
abstractbase class exposes someabstractmembers that need to be implemented by derived classes.