I was just wondering, I am currently writing a data model in C# for a blog site, and I'm using derived classes. But the annoying thing is, I have to initialize the base class' fields in the derived class' constructor, like below:
public class baseClass
{
public dateTime dateCreated { get; protected set; } //only protected because that's what I need...
}
public class derivedClas : baseClass
{
public derivedClass
{
this.dateCreated = DateTime.Now;
}
}
So what I want to do is instead of manually setting the field in the derived class, I want to set it automatically in the baseClass whenever a new instance of derivedClass is created. Is this possible?