Monday, December 8, 2008

Features of Structures

Features of Structures: -

* A structure or struct can contain only fields, methods, Etc.,

* In struct we can't initialize the variable whereas in class it can be possible

* It must be initialized either through function or using object

* Fields can't be given initial values at that time of creation.

* struct can't have a constructor.

* struct can't support the concept of inheritance

* We can derive a structure from an interface

* We can't inherit from sealed class

* A structure could not inherit from a class, the reverse is also true

* You can't declare a struct as sealed, because by default it is sealed

* A structure declare as abstract can't be used as a base class, i.e., be used in a derivation

* No destructor for struct

* struct are created on the stack and die when we reach the closing brace

No comments: