TAILIEUCHUNG - HandBooks Professional Java-C-Scrip-SQL part 105

@implementation Circle -(float )radius { return radius ; } -(void )radius :(float )r { radius = r ; } @end Don't use "get" in the name of your accessors. By convention, methods whose names start with "get" take an address into which data will be copied. If you are using reference counting, there are more design patterns you should follow when writing accessors. These are discussed in Section . Message search paths When you send an object a message (call one of its methods), the code that actually runs is determined by a search performed at runtime. The dispatch. | @implementation Circle - float radius return radius - void radius float r radius r @end__ Don t use get in the name of your accessors. By convention methods whose names start with get take an address into which data will be copied. If you are using reference counting there are more design patterns you should follow when writing accessors. These are discussed in Section . Message search paths When you send an object a message call one of its methods the code that actually runs is determined by a search performed at runtime. The dispatch of the method call proceeds as follows 1. The runtime system examines the object at the actual time the message is sent and determines the object s class. 2. If that class has an instance method with the same name the method executes. 3. If the class does not have such a method the same search takes place in the parent class. 4. The search proceeds up the inheritance tree to the root class. If a method with a matching name is found that method executes. 5. If there is no matching method but the receiver has a forwarding method the runtime system calls the forwarding method. See Section . Default forwarding behavior is to exit the program. 6. If there are no forwarding methods the program normally exits with an error. Section describes how to change this. Section provides more details about method dispatch. Special receivers The receiver is the object to which you are sending a message. Its instance methods will be given the first chance to handle the call followed by the instance methods of its ancestor classes. Besides the typical case of sending a message to a named receiver there are several special targets self Refers to the object that is executing the current method. At runtime the class of self may be the class in which the call to self appears or it may be a subclass. super Refers to the inherited version of the method. When you use

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.