class - running Car c=new Driver(); in C# -


suppose we've 2 classes car , driver,,
, able make object

car c=new driver(); 

and able calling members of car class not of driver class why , when ? ?

even though reference c points driver object, type of reference (car) determines methods can called on it.

as side note, having driver class derived car not make sense. class inheritance can expressed "is-a" relationship, , drivers not cars.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -