Skip to main content
11 events
when toggle format what by license comment
Nov 12, 2019 at 4:53 comment added BVernon You said: "Shall we create many Card instances for each ace of spade?" Would you not?
Jul 2, 2014 at 2:17 comment added Mark Hurd @supercat This is worthy of a separate question or a chat session, but I'm not currently interested in either :-( You say (in C#) "structures that implement interfaces behave differently from class objects that do likewise". I agree that there are other behavioral differences to consider, but AFAIK in code following Interface iObj = (Interface)obj;, the behaviour of iObj is not affected by the struct or class status of obj (except that it will be a boxed copy at that assignment if it is a struct).
Apr 28, 2014 at 16:10 audit First posts
Apr 28, 2014 at 16:13
Apr 11, 2014 at 15:45 audit First posts
Apr 11, 2014 at 15:46
Apr 7, 2014 at 7:44 vote accept RokL
Apr 6, 2014 at 10:05 comment added alexis +1 for why "it's not equal to having global functions." This hasn't been much addressed by others. (Although if you have several decks, a global function would still return different values for distinct instances of the same card).
Apr 5, 2014 at 23:19 comment added supercat @Aschratt: Structures don't support inheritance. Structures can implement interfaces, but structures that implement interfaces behave differently from class objects that do likewise. While it's possible to make structs behave somewhat like objects, the best use case for structs in when one wants something that behaves like a C struct, and the things one is encapsulating are either primitives or else immutable class types.
Apr 2, 2014 at 15:05 comment added Aschratt Just a note about structures in C#: They are no typical structs, like you know them in C. In fact, they do also support OOP with inheritance, encapsulation and polymorphism. Besides some peculiarities the main difference is how the runtime handles instances when they are passed to other objects: structures are value types and classes are reference types!
Apr 2, 2014 at 14:04 history edited Konrad Morawski CC BY-SA 3.0
added 105 characters in body
Apr 2, 2014 at 13:57 history edited Konrad Morawski CC BY-SA 3.0
added 212 characters in body
Apr 2, 2014 at 13:52 history answered Konrad Morawski CC BY-SA 3.0