Consider I have 2 classes:
public class ComplicatedParent
{
// Lots of data
}
public class SimpleChild : ComplicatedParent
{
public string SomeAdditionalData { get; set; }
public SimpleChild(string arg) : base()
{
SomeAdditionalData = arg;
}
}
And SomeFunction
that returns instance of ComplicatedParent
. Is there a simple way to construct child from parent's reference, preserving parent's state?
Actually ComplicatedParent
class and SomeFunction
are third party so I can't change them.