Created
April 4, 2012 22:29
-
-
Save albertodebortoli/2306149 to your computer and use it in GitHub Desktop.
Abstract Method macro on iOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DEFINE_ABSTRACT_METHOD(returnType, name)\ | |
- (returnType)name {\ | |
@throw [NSException exceptionWithName:NSInternalInconsistencyException\ | |
reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)]\ | |
userInfo:nil];\ | |
} | |
// usage | |
DEFINE_ABSTRACT_METHOD(<<returnType>>, <<methodNameWithOrWithoutArgs>>); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment