c# - How many instances and references are created for a Base-Sub Class? -


In C # .NET, I have 2 concrete classes I class A and B class B. A subclass of class A is.

How many examples (objects on a pile) and stack objects from the stack are made for each line code:

<<>
  • class bb = New class b ();

  • class A = new square b ();

  • The object that is going with an analogy The balloon and reference is a string that is bound to the sand, in each of the following cases there will be a balloon and a string:

      square bb = new square b (); // a reference, a heap object class AA = new classbie (); // One reference, a heap object  

    Running both at the same time will therefore create two objects and two references.

    EDIT generated from the ClassB constructor at a glance on this IL:

      .method Public Hidden Reader Special Name rtspecialname Example zero () Cil Managed {// Code Size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: Call Instance Zero InheritanceTest Class A :: CTOr (IL_0006: ret} method's // and classbie :: CTOR  

    call installation void InheritanceTest.ClassA :: .ctor () Indicates that this class constructor as a member function (not as a function on a member object). It is with my understanding that the examples of heritage classes What happens with this is that the derivative classes are only all members of the base class, the subsequent members themselves, Ase C ++.


    Comments

    Popular posts from this blog

    c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

    Calling GetGUIThreadInfo from Outlook VBA -

    Obfuscating Python code? -