Thursday, November 4, 2010

FAQ on OOPS concepts

Q1. What is the diffrence between CLASS and STRUCT?
Ans.
a). Structs are value types but class are referenced type.
b). All struct types implicitly inherit from the class System.ValueType
c).Assignment to a variable of a struct type creates a copy of the value being assigned .
d).The default value of a struct is the value produced by setting all value type fields to their default value and all reference type fields to null.
e).Boxing and unboxing operations are used to convert between a struct type and object.
f).The meaning of this is different for structs.
g).Instance field declarations for a struct are not permitted to include variable initializers.
h).A struct is not permitted to declare a parameterless instance constructor.
i).A struct is not permitted to declare a destructor.
For more info please goto :http://msdn.microsoft.com/en-us/library/aa288471(VS.71).aspx