🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cs.works.next
Article #1

respondsTo

#1
From: Yufeng Tsui
Date: Thu, 20 Jul 1989 04:22
58 lines
1621 bytes
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)			  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID: <23548@iuvax.cs.indiana.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!iuvax!daemon

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!iuvax!daemon
From: tsui@silver.bacs.indiana.edu (Yufeng Tsui)
Newsgroups: cs.works.next,comp.sys.next
Subject: respondsTo
Message-ID: <23548@iuvax.cs.indiana.edu>
Date: 20 Jul 89 04:22:46 GMT
Sender: daemon@iuvax.cs.indiana.edu
Lines: 58