Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 10. Introspection > Testing for Methods

10.1. Testing for Methods

Java doesn't have a simple, concise method for determining if an object implements a specific method. Instead, Java programs tend to create classes and interfaces that implement functional groups of methods. The programmer then tests an object for membership in those classes or interfaces. This works well in Java because of its strong type checking and strict inheritance model.

Objective-C's class structure is much more relaxed and dynamic, so the assumptions one can make in Java are not as applicable. The preferred method of determining if an object implements a particular method is to test that directly, as shown in Listing 10-1.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial