• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Today's fascinating C# quiz

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Today's fascinating C# quiz

    In what order do point A,B,C,D and E execute given the following?

    Code:
    public class Base
    {
    int x = 1; // Point A
    public Base (int x)
    {
    ... // Point B
    }
    }
    public class Derived : Base
    {
    int y = 1; // Point C
    public Derived (int x)
    : base (x + 1) // Point D
    {
    ... // Point E
    }
    }


    I know you guys really enjoy this sort of thing.....

    #2
    Originally posted by DimPrawn View Post
    I know you guys really enjoy this sort of thing.....
    Is your new job a lecturer in a Uni?

    Microsoft is in terminal decline now, get yourself tooled up with Java.

    Comment


      #3
      Originally posted by AtW View Post
      Is your new job a lecturer in a Uni?

      Microsoft is in terminal decline now, get yourself tooled up with Java.
      I'm teaching to special needs types. You know the answer?

      Comment


        #4
        Originally posted by DimPrawn View Post
        You know the answer?
        Yes.

        But it's not the answer you'd like.

        The answer is ...


        ... those who write such a piss poor ambiguous code that creates dangerous dependencies on order in which vars are initialised should be fired.

        Happy now?

        Comment


          #5
          Originally posted by AtW View Post
          ... those who write such a piss poor ambiguous code that creates dangerous dependencies on order in which vars are initialised should be fired.
          How do you think dim has time to post these stupid quizzes.
          merely at clientco for the entertainment

          Comment


            #6
            Originally posted by AtW View Post
            Is your new job a lecturer in a Uni?

            Microsoft is in terminal decline now, get yourself tooled up with Python.
            FTFY
            Doing the needful since 1827

            Comment


              #7
              PHP Code:
              public class Base
              {
              int x 1// Point U
              public Base (int x)
              {
              ... 
              // Point N
              }
              }
              public class 
              Derived Base
              {
              int y 1// Point C
              public Derived (int x)
              base (1
              {
              ... 
              // Point T
              }

              If you think my attitude stinks, you should smell my fingers.

              Comment


                #8
                Originally posted by eek View Post
                How do you think dim has time to post these stupid quizzes.

                Comment


                  #9
                  I am not a C# programmer but I would think that if you declared a variable of type Derived it would go:

                  ACDEB

                  Although I have to admit I am not that confident!
                  "He's actually ripped" - Jared Padalecki

                  https://youtu.be/l-PUnsCL590?list=PL...dNeCyi9a&t=615

                  Comment


                    #10
                    Originally posted by DimPrawn View Post
                    In what order do point A,B,C,D and E execute given the following?

                    Code:
                    public class Base
                    {
                    int x = 1; // Point A
                    public Base (int x)
                    {
                    ... // Point B
                    }
                    }
                    public class Derived : Base
                    {
                    int y = 1; // Point C
                    public Derived (int x)
                    : base (x + 1) // Point D
                    {
                    ... // Point E
                    }
                    }
                    None of it is executed. It's just a declaration.
                    Will work inside IR35. Or for food.

                    Comment

                    Working...
                    X