This is my oops question.
This is my base class
public class BaseClass
{
   public int i = 10;
   public int x = 30;
   public string str = "Hello";
   public virtual string Hello()
   {
     return "Hello of base class called";
   }
}
This is my child class
public class ChildClass : BaseClass
{
    public int i = 20;
    public int z = 90;
    public override string Hello()
    {
       return "Hello of child class called";
     }
}
I have noticed that following works fine
BaseClass baseObject = new ChildClass();
and if I enter baseObject, then only members of BaseClass are shown
- Can someone provide me some advice on a circumstance in which a developer needs to do something like BaseClass baseObject = new ChildClass();?
 
- Why are my child member variables not accessible through this baseObject if my BaseClass object has a reference to my child class object?