Here I have the following code in which I have created two class A and B. Then in the main method, I created the object of both the class and assign child object to parent object. I don't understand how it works in c# can anyone explain me?
class Program
{
static void Main(string[] args)
{
A objA = new A();
B objB = new B();
objA = objB;
Console.ReadLine();
}
}
public class A
{
public string ABC { get; set; }
public string XYZ { get; set; }
public string lmn { get; set; }
}
public class B : A
{
private string vvmdn { get; set; }
public string mkkk { get; set; }
}