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
C#
C# Quiz
Start Quiz

or Read more about C# Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback