class Car{ // any fields here. } class BMW : Car{ // any fields here. } void main(){ BMW myBMW = new BMW(); // Case 1 -> it works Car myBMW = new BMW(); // Case 2 -> it works }
BMW myBMW = new Car();
BMW myBMW = new BMW();
Object
Car
BMW
Car myCar = new BMW();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)