I have been clearing my concepts regarding inheritance and investigating if parent reference variable can point to child class object and vice versa.

using System;
using System.Collections.Generic;
using System.Text;

namespace oops
{
public class A
{
public A()
{
Console.WriteLine("A");
Console.WriteLine("===============================");
}
public void Add()
{
Console.WriteLine("Add");
}
}

public class B : A
{
public B()
{
Console.WriteLine("B");
Console.WriteLine("===============================");
}

public void Sub()
{
Console.WriteLine("Sub");
}

}

class Program
{
static void Main(string[] args)
{
A objA = new A();

B objB = objA as B;
A objAB = new B();

B objBB = objAB as B;
objBB.Sub();

if (objB is B)
{
objB.Add();
}
else
{
Console.WriteLine("objB is not B");
}

//objA.Add();
Console.ReadLine();
}
}
}

Out put of the code is

A

===============================

A

===============================

B

===============================

Sub

objB is not B