June 26. NET face question (program part) as long as do understand these 3 questions must be able to leave the rookie title!

Source: Internet
Author: User

Description: 1, if you just want to know the correct answer, copy the code to run on vs.

2, these 3 questions I will not do, seek guidance (only need to tell me the knowledge point of the investigation on the line ~)

1. What is wrong with the code below, and if so, how to correct it? (I feel right ~ ~)

    public class A    {public        virtual void F ()        {            Console.WriteLine ("A.F");        }    }    Public abstract class B:a    {public        abstract override void F ();    }

2, a comprehensive problem, the following program output is? (feeling very comprehensive, ask the master to tell this question have examined what knowledge points ~ ~ ~)

Using System;namespace consoleapplication1{    internal class program    {        private static void Main (string[] args)        {            var a = new A ();            A B = new B ();            A.fun2 (b);            B.fun2 (a);            Console.readkey ();        }    }    Internal Class A    {public        a ()        {            Console.WriteLine ("a");        }        public virtual void Fun1 (int i)        {            Console.WriteLine (i);        }        public virtual void Fun2 (a a)        {            a.fun1 (1);            FUN1 (3);        }    }    Internal class b:a    {public        B ()        {            Console.WriteLine ("B");        }        public override void Fun1 (int i)        {            base. FUN1 (i + 1);        }        Public new void Fun2 (a a)        {            a.fun1 (2);            FUN1 (5);}}    

3, the overall problem, the following program output is? (also answer wrong, ask to tell what knowledge points have been examined ~ ~)

Using System;namespace consoleapplication2{    internal class program    {        private static void Main (string[] args)        {            Console.WriteLine ("X={0},y={1}", A.x.tostring ("X2"), B.y.tostring ("X"));            Console.readkey ();        }    }    public class A    {public        static int x;    }    public class B    {public        static int y = a.x + 1;        Static B ()        {        }}    }

June 26. NET face question (program part) as long as do understand these 3 questions must be able to leave the rookie title!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.