<title></title>
Tester. h
# Import<Foundation/Foundation. h>
@ Interface Tester: nsobject {
}
-(Void) Test :( nsstring*) MSG;
-(Void) Noibd;
@ End
Tester. m
# Import"Tester. h"
@ Implementation Tester
-(Void) Test :( nsstring*) Msg
{
Nslog (@"% @", MSG );
}
@ End
Note: The noibd method is not implemented.
<title></title>
Main. m
# Import < Foundation / Foundation. h >
# Import " Tester. h "
Int Main ( Int Argc, Const Char * Argv [])
{
NSAID utoreleasepool * Pool = [[NSAID utoreleasepool alloc] init];
Id Tester = [[Tester alloc] init]; // Note that ID is used here
Sel testselector = @ Selector (test :);
Sel notimpselector = @ Selector (noibd :);
If ([Tester respondstoselector: testselector])
{
// The test method is implemented in tester. M.
[Tester test: @" Invoke Test Method " ];
}
If ([Tester respondstoselector: notimpselector])
{
// If this master is not implemented in test. m
[Tester noibd];
}
[Pool drain];
Return 0 ;
}