Given following classes:
 
class A { int x; } 

class B : A { int y; } 
Which code fragments will compile and run successfully?
Explanation
Object a = new A();
Object b = (B)a;
will compile successfully as well, but throw an exception at runtime

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести