C# Programming - Structures - Discussion

Discussion Forum : Structures - General Questions (Q.No. 18)
18.
Which of the following statements are correct about Structures used in C#.NET?
  1. A Structure can be declared within a procedure.
  2. Structs can implement an interface but they cannot inherit from another struct.
  3. struct members cannot be declared as protected.
  4. A Structure can be empty.
  5. It is an error to initialize an instance field in a struct.
1, 2, 4
2, 3, 5
2, 4
1, 3
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
2 comments Page 1 of 1.

Sarath said:   1 decade ago
Structure do not support inheritance.

Nicholas Mahbouby said:   1 decade ago
Answer 4 is also correct. Structures can be empty. The code following code will compile, however in reality the struct inherits members from the base class System.ValueType and is not really empty.

struct A
{
}

Post your comments here:

Your comments will be displayed after verification.