What will be the Correct statement in the following C# code? [code] class baseclass { int a; public baseclass(int a1)

Tâm Tây

New member
What will be the Correct statement in the following C# code?
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
D. The program will work correctly if we replace base(a1) with base.baseclass(a1)
 

Tìm kiếm

Back
Top