Object-oriented programming · interview question
Which statements about struct types in C# are true? Select all that apply.
Select all that applyMedium
Answer and explanation
Correct answer
- A. A struct is a value type.
- C. A struct can implement interfaces.
- D. Assigning one struct variable to another copies the data.
Why
Structs are value types with copy semantics. They can implement interfaces but can't take part in inheritance. Where they're stored depends on where they're declared.
Test yourself on Object-oriented programming
A free test with instant, explained results. No account needed.