O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 20

Answers to Chapter 20 Review Questions

1: What are the similarities and differences between delegates and abstract methods?
A1: Similarities:
  • They both specify a return type and parameters for a method that they are able to represent and invoke at runtime.

  • They both allow you to postpone the decision of which method to invoke until runtime.

Differences:

  • The method name must match that of the abstract class. The method name is irrelevant for the delegate.

  • Abstract methods work through inheritance, interfaces, and dynamic binding.

  • Generally, delegates are more suited for event handling purposes.

2: Why is delegate a good name for the delegate construct?
A2: A delegate is called like a method, but unlike the method, it does not execute the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required