Which lines contain errors?
 
using System; 
namespace Inheritance 
{ 
      class A { } 
      interface Inner { } 
      struct S : A, Inner //1 
      { 
          int num = 10;   //2 
          public S()       //3 
          { 
          } 
          static S()      //4 
          { 
          } 
      } 
      class Program 
     { 
         static void Main(string[] args) 
         {
            S obj = new S(); //5 
         } 
     }
 }
 
Explanation
1 - structures do not support classical inheritance, and A is a class name
2 - fields of the structures can not be initialized during the declaration
3 - it's not allowed to declare default constructors
C#
C# Quiz
Learn C# Online

or Read more about C# Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback