class Dog
{
}
class BullDog : Dog
{
}
class Program
{
static void Main()
{
Dog dog2 = new BullDog();
BullDog dog3 = new BullDog();
}
}
-
What is the difference between using Dog as a reference vs BullDog as a reference?
-
I have an habit of using
var dog3 = new BullDog();, which is similar toBullDog dog2 = new BullDog();. When do we need to useDog dog2 = new BullDog();?
EDIT: To address the additional question from the comments:
One last thing to understand: