Tuesday, June 11, 2013

C# Questions and Answers – Part 2

What is a constructor?
A constructor is a special method with the same name as the class. It is executed when an instance of the class is created and can contain code to initialize the instance.
What is the difference between public, static and void?
All these are access modifiers in C#. Public declared variables or methods are accessible anywhere in the application. Static declared variables or methods are globally accessible without creating an instance of the class. Void specifies that the method does not return a value.
What is an interface?
An interface contains only the signatures of methods, delegates or events. The implementation of the methods is done in the class that implements the interface. Read more http://msdn.microsoft.com/en-us/library/87d83y5b(v=VS.80).aspx
What is a delegate?
Delegate is a reference type that can be used to encapsulate a named or an anonymous method. Delegates are similar to function pointers in C++; however, delegates are type-safe and secure. Read more http://msdn.microsoft.com/en-US/library/900fyy8e(v=vs.80).aspx

Previous posts:
C# Questions and Answers
C# Questions and Answers – Part 2
C# Questions and Answers – Part 3

No comments:

Post a Comment