[comp.sys.next] respondsTo

tsui@silver.bacs.indiana.edu (Yufeng Tsui) (07/20/89)

Now here is something I can not figure out why, can anyone enlighten me please?

I defined a class:

@implementation MyMatrix: Matrix
{
...
}

+newFrame:aFrame
{
  ...
}

-cellPressed:sender
{

 ....
}

-deleteSelf:sender
{

}

@end

In some other place I have the following code:

myMatrix = [MyMatrix newFrame:&aframe];
...
if ([myMatrix respondsTo:@selector(cellPressed:)]) {
 ...
}
if ([myMatrix respondsTo:@selector(deleteSelf:)]) {
 ...
}
 
...


Then I found myMatrix responds to cellPressed: but does not respond to 
deleteSelf.

I did not understand why and I switched the place of cellPressed: and
deleteSelf: in the implementation of MyMatrix.  Now the above piece
of code says myMatrix only responds to deleteSelf:, not to cellPressed:
It seems like it only responds to the first method defined.  Now what is
going on? What am I missing?  BTW, I set the target of myMatrix to itself.
IS it allowed?  Thanks

--yufeng
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Yufeng Tsui, IU.   HOME OF HOOSIERS	          
{ihnp4!inuxc,rutgers,pyramid}!iuvax!silver!tsui	  
tsui@silver.bacs.indiana.edu (192.12.206.2)	  
tsuiy@iubacs.bitnet (forwarded)			  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~