Today's fascinating C# quiz Today's fascinating C# quiz
Page 1 of 3 123 LastLast
Posts 1 to 10 of 30
  1. #1

    Richer than sasguru

    DimPrawn is a fount of knowledge

    DimPrawn's Avatar
    Join Date
    Jul 2005
    Location
    Brexit Britain
    Posts
    34,856

    Default 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.....
    I have left CUK...please do not expect any replies to threads or PMs...

  2. #2

    My post count is Majestic

    AtW is a fount of knowledge

    AtW's Avatar
    Join Date
    Jul 2005
    Posts
    51,801

    Default

    Quote 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.

  3. #3

    Richer than sasguru

    DimPrawn is a fount of knowledge

    DimPrawn's Avatar
    Join Date
    Jul 2005
    Location
    Brexit Britain
    Posts
    34,856

    Default

    Quote 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?
    I have left CUK...please do not expect any replies to threads or PMs...

  4. #4

    My post count is Majestic

    AtW is a fount of knowledge

    AtW's Avatar
    Join Date
    Jul 2005
    Posts
    51,801

    Default

    Quote 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?

  5. #5

    bored now

    eek is a fount of knowledge

    eek's Avatar
    Join Date
    Jun 2010
    Location
    😂
    Posts
    23,229

    Default

    Quote 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

  6. #6

    Super poster

    amcdonald is too good to be a permie

    amcdonald's Avatar
    Join Date
    Oct 2010
    Location
    Down the pub
    Posts
    3,090

    Default

    Quote 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

  7. #7

    CUK gives you wings

    hyperD has more data than eek

    hyperD's Avatar
    Join Date
    Jul 2005
    Posts
    8,452

    Default

    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.

  8. #8

    My post count is Majestic

    AtW is a fount of knowledge

    AtW's Avatar
    Join Date
    Jul 2005
    Posts
    51,801

    Default

    Quote Originally Posted by eek View Post
    How do you think dim has time to post these stupid quizzes.

  9. #9

    Super poster

    MyUserName is NOT a disguised employee

    MyUserName's Avatar
    Join Date
    Jan 2012
    Location
    Oh ... not far
    Posts
    4,459

    Default

    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

  10. #10

    Lord of the Vectras

    VectraMan - scorchio!

    VectraMan's Avatar
    Join Date
    Dec 2005
    Location
    European Union (Yorkshire)
    Posts
    11,442

    Default

    Quote 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •