Skip to content
Discussion options

You must be logged in to vote

I think the spec is meant to allow calling base() in this case implicitly, which is what happens both with your hand-written and auto-generated copy constructors. One way to see that is to look at the generated IL. For the hand-written constructor, it's:

    .method family hidebysig specialname rtspecialname 
        instance void .ctor (
            class Number original
        ) cil managed 
    {
        // Method begins at RVA 0x20ab
        // Code size 19 (0x13)
        .maxstack 8

        IL_0000: ldarg.0
        IL_0001: call instance void [System.Private.CoreLib]System.Object::.ctor()
        IL_0006: ldarg.0
        IL_0007: ldarg.1
        IL_0008: callvirt instance int32 Num…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by pkulikov
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants