code_junkie

how to block a superclass method to be called to a subclass

Nov 12th, 2011
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. - (int)dangerousMethod
  2. {
  3. [NSException raise:@"Danger!" format:@"Do not call send this method directly to this subclass"];
  4. return nil;
  5. }
  6.  
  7. @implementation MyClass
  8. -(void)myMethod:(NSString *)txt{
  9. if([self class] != [MyClass class]) return;
  10. NSLog(@"Hello");
  11. }
  12. @end
Add Comment
Please, Sign In to add comment