Friday, July 8, 2011

static

1. Which operators cannot be overloaded  ?
 =, ., ?:, ->, new, is, sizeof, typeof
2. Comparsion operator
 ==, !=, <, >, <=, >=
They must be overloaded in pairs.
3.  How do you overload operators ?
By defining static member functions using the operator keyword.
4. Can non-static classes contain static members ?
 YES.
5. Can static classes contain non-static members ?
 NO.
6. Can you access static members of non-static classes using instances of non-static members ?
 NO. Static members must be accessed using thier class names, not using instances
7. What all can be static ?
method, field, property, or event
constructors can be static.
const behave like static fields , but static keyword cannot be used with them
operator overloading functions are always a static
Indexers cannot be static, the allowed access specifiers for indexers are only 

No comments:

Post a Comment