Information Technology Reference
In-Depth Information
This code produces the following output:
Calling through: object.
Figure 17-5 illustrates the duplicate interface methods being implemented by a single
class-level method implementation.
Figure 17-5. Multiple interfaces implemented by the same class member
References to Multiple Interfaces
You saw previously that interfaces are reference types, and that you can get a reference to
an interface by casting an object reference to the interface type. If a class implements multiple
interfaces, you can get separate references for each one.
For example, the following class implements two interfaces with the single method
PrintOut . The code in Main calls method PrintOut in three ways:
￿
Through the class object
Through a reference to the IIfc1 interface
￿
￿
Through a reference to the IIfc2 interface
Search WWH ::




Custom Search