Vidyalelo
C# Programming · Q62

Classes and Objects in C Sharp

Programming · C# Programming · question 62

Q62

What will be the Correct statement in the following C# code? class baseclass int a; public baseclass(int a1) a = a1; console.writeline(" a "); class derivedclass : baseclass public derivedclass (int a1) : base(a1) console.writeline(" b "); class program static void main(string[] args) derivedclass d = new derivedclass(20);

A.
Compile time error
B.
b
a
C.
a
b
Answer
D.
The program will work correctly if we replace base(a1) with base.baseclass(a1)

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board