C#.Net Interview Question and Answers
36. |
What is a base class? |
|
A class declaration may specify a base class by following the class name with a colon and the name of the base class. omitting a base class specification is the same as deriving from type object. |
|
|
37. |
Can “this” be used within a static method? |
|
No ‘This’ cannot be used in a static method. As only static variables/methods can be used in a static method. |
|
Digvijay Kumar Singh, said |
Jan 17,2014 |
No Reasion– this keyword is instance that taken the refrence of currrent object and we know statis method alwase call by class name so we can not used the object or instance in static method.
|
|
38. |
What is difference between constants, readonly and, static? |
|
- Constants: The value can’t be changed.
- Read-only: The value will be initialized only once from the constructor of the class.
- Static: Value can be initialized once.
|
|
Rakesh, says |
Jan 04,2014 |
Static: Value can be changed in runtime, but will have the global point of access(Common value across all objects).
|
|
39. |
What are the different types of statements supported in C#? |
|
C# supports several different kinds of statements are
- Block statements
- Declaration statements
- Expression statements
-
Selection statements
- Iteration statements
- Jump statements
- Try catch statements
- Checked and unchecked
- Lock statement
|
|
|
40. |
What is an interface class? |
|
It is an abstract class with public abstract methods all of which must be implemented in the inherited classes. |
|
|