News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

Events,Delegates,Method and Property Questions

Started by VelMurugan, Aug 14, 2008, 08:46 PM

Previous topic - Next topic

VelMurugan

Method and Property Questions

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.
 
What does the keyword "virtual" declare for a method or property?
The method or property can be overridden.
 
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.
 
Can you declare an override method to be static if the original method is not static?
No.  The signature of the virtual method must remain the same.  (Note: Only the keyword virtual is changed to keyword override)
 
What are the different ways a method can be overloaded?

Different parameter data types, different number of parameters, different order of parameters.
 
If a base class has a number of overloaded constructors, and an inheriting 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.

Events and Delegates


What's a delegate?
A delegate object encapsulates a reference to a method.
 
What's a multicast delegate?
A delegate that has multiple handlers assigned to it.  Each assigned handler (method) is called.

XML Documentation Questions

Is XML case-sensitive?
Yes.
 
What's the difference between // comments, /* */ comments and /// comments?
Single-line comments, multi-line comments, and XML documentation comments.
 
How do you generate documentation from the C# file commented properly with a command-line compiler?
Compile it with the /doc switch.