Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,5 +1,9 @@
Multiple inheritance allows to specify that one [[classes | class]] is a subclass of several other classes. Some languages allow multiple [[inheritance]] for arbitrary classes, others restrict it to interfaces, some don't allow it at all.
Multiple inheritance allows to specify that one [[classes | class]] is a subclass of several other classes.
Some languages allow multiple [[inheritance]] for arbitrary classes,
others restrict it to interfaces, some don't allow it at all.
Write two classes (or interfaces) <tt>Camera</tt> and <tt>MobilePhone</tt>, then write a class <tt>CameraPhone</tt> which is both a <tt>Camera</tt> and a <tt>MobilePhone</tt>.
Write two classes (or interfaces) <tt>Camera</tt> and <tt>MobilePhone</tt>,
then write a class <tt>CameraPhone</tt> which is both a <tt>Camera</tt> and
a <tt>MobilePhone</tt>.
There is no need to implement any functions for those classes.

View file

@ -20,7 +20,7 @@
@implementation CameraPhone
-(id)init {
-(instancetype)init {
if ((self = [super init])) {
camera = [[Camera alloc] init];
phone = [[MobilePhone alloc] init];
@ -38,6 +38,12 @@
[self doesNotRecognizeSelector:aSelector];
}
-(NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector {
return [camera methodSignatureForSelector:aSelector]
?: [phone methodSignatureForSelector:aSelector]
?: [super methodSignatureForSelector:aSelector];
}
-(BOOL)respondsToSelector:(SEL)aSelector {
return [camera respondsToSelector:aSelector]
|| [phone respondsToSelector:aSelector]