Question:Write difference between classes and structs in C#. 

Answer 1. Classes are Reference types and Structures are Values types. 2. Classes can have explicitly parameterless constructors whereas structures can’t. 3. A variable can be null if it’s a class, but is never null if it’s a struct. 4. Member variable initialization is possible in class whereas in Structures, it is not. 

+ Report
Total Preview: 816
Write difference between classes and structs in C#.
Copyright © 2024. Powered by Intellect Software Ltd