98-361 · Question #380
You are writing code to handle events in your program. You define a delegate named PolygonHandler like this: public delegate void PolygonHandler(Polygon p); You also create a variable of the…
Sign in or unlock 98-361 to reveal the answer and full explanation for question #380. The question stem and answer options stay visible for context.
Question
You are writing code to handle events in your program. You define a delegate named PolygonHandler like this:
public delegate void PolygonHandler(Polygon p); You also create a variable of the PolygonHandler type as follows:
PolygonHandler handler; Later in the program, you need to add a method named CalculateArea to the method invocation list of the handler variable. The signature of the CalculateArea method matches the signature of the PolygonHandler method. Any code that you write should not affect any existing event-handling code. Given this restriction, which of the following code lines should you write?
Options
- Ahandler = new PolygonHandler(CalculateArea);
- Bhandler = CalculateArea;
- Chandler += CalculateArea;
- Dhandler -= CalculateArea;
Unlock 98-361 to see the answer
You've previewed enough free 98-361 questions. Unlock 98-361 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.