class - What happens when you create an instance of an object containing no state in C#? -


I think I'm fine in algorithm programming, if this is the correct word? I wanted to play Turbo Pascal and 8086 assembly language as a hobby in the 1980s. But there are only very small projects and I have not actually done any programming in 20 years since then. So I am struggling to understand like a drowning swimmer.

So maybe this is a very intense question or I'm not at all understanding, but say I have such a thing:

  class something: IDOER { Cancel void (isometringelse X) {x.DoWhatEverYouWant (42); }}  

and then I

  var Thing 1 = new something (); Var Thing 2 = new (); Thing1.Do (blah); Thing2.Do (blah);  

Thing 1 = Thing 2? "Does something new" () can make anything? Or it is not different from a static class, except that I can pass it and swap it etc. etc.

Is there one place in memory for both Thing 1 (Blah) "and Thing 2 (Blah) objects? I mean, while executing it, does it mean that there are two things? What processes or just one?

There are definitely two different objects in the archive, each object stack Will consume 8 bytes (at least 32-bit systems); 4 for syncblock and 4 types of handles In addition to system defined state data, there is no other user-defined state data in your case (including the method table).

Something.Do Example: Type object pointer which holds each object how to find different ways for CLR class, even though there are two different objects in memory, they both execute the same code. However, something. A was declared as an instance method because in this one this pointer would be passed internally so that the code can modify the correct example members, The process on which the object was being applied. There is no member of the some category in your case (and there is no user-defined state in this way) and therefore it is quite irrelevant, but still it happens.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -