Could somebody please verify that this method does what I expect it to do?
I need such a test within NSDocument. Here Apple takes special care that
if somebody has implemented the old interface methods for NSDocument in
a subclass, then these methods are actually called instead of the new
interface methods.

/*
 * Private helper method to check, if the method given via the selector sel
 * has been overridden in the current subclass.
 */
- (BOOL)_hasOverridden: (SEL)sel
{
  // The actual signature is not important as we wont call the methods.
  IMP meth1;
  IMP meth2;

  meth1 = [self methodForSelector: sel];
  meth2 = [[NSDocument class] instanceMethodForSelector: sel];

  return (meth1 != meth2);
}

If the code stays that simple, I might even make a macro of it.

Cheers,
Fred


_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to