文档详情

ios黑马入学考试exam(The ios black horse entrance exam exam).doc

发布:2017-07-22约1.01万字共22页下载文档
文本预览下载声明
ios黑马入学考试exam(The ios black horse entrance exam exam) 1. The difference between Self and super? Slef calls itself methods and does not invoke the parent class; Super calls the parent class method 2. Talk about your understanding of object-oriented. Object oriented from the process oriented, it is a way of thinking, focus on the relationships between objects, rather than its internal details, its just like carmaking, respectively, shall we go to production engine, chassis, body, and then to assemble, rather than starting from a certain parts, do a pack 3. The difference between categories and inheritance? Classes are used to add new methods that cannot change the original method, and if the conflict is overridden, inheritance adds change to the original method and can add attributes, and inheritance is more powerful 4. When defining attributes, do you use copy, assign, retain, strong, week Retain: release old value, retain new value (for OC objects) Assign: assign directly, without any memory management (default, for non-oc object types) Copy: release old value, copy new value (general for NSString *) Strong: a strong member variable is equal to rentain Weak: member variable weak pointer is equal to assign 5. There is a Baby class, with Cry behavior (method, meaning crying), and the Baby can match a babysitter, but as a babysitter, she must abide by the babysitter protocol: the act of being able to handle the Babys Cry. Please design a set of agent design pattern (objective-c) according to the above description. So lets define the protocol Delegate_lookafter. H @ protocol lookafterbaby NSObject - (void) lookafter; @ the end Define Nanny Nanny. H should follow the delegate_lookafter protocol # import Foundation/Foundation. H H # import delegate_lookafter. @interface Nanny: NSObject lookafterbaby @ the end Nanny. M implements the child care method H # import Nanny. @ implementation Nanny: NSObject - (void) lookafter { NSLog (@babysitter doesnt cry); } @ the end D
显示全部
相似文档