Google
 

C# IQ-55

31. What’s the implicit name of the parameter that gets passed into the set method/property of a class?
value. The data type of the value parameter is defined by whatever data type the property is declared as.

32. What does the keyword “virtual” declare for a method or property?
The method or property can be overridden.

33. How is method overriding different from method overloading?
When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.

34. Can you declare an override method to be static if the original method is non-static?
No. The signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.

35. Can you override private virtual methods?
No. Private methods are not accessible outside the class.
1. Original answer: No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.

36. What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.

37. If a base class has a number of overloaded constructors, and an inherited class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

38. Why is it a bad idea to throw your own exceptions?
Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block?
Throwing your own exceptions signifies some design flaws in the project.
39. What’s a delegate?
A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
40. What’s a multicast delegate?
It’s a delegate that points to and eventually fires off several methods.

41. How is the DLL Hell problem solved in .NET?
Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.

42. What are the ways to deploy an assembly?
An MSI installer, a CAB archive, and XCOPY command.

No comments: