Message links can be associated with the methods of the recipient class. The methods can be selected from the list of existing ones or can be created. This is done by two commands provided by the message context menu: Add and Choose method.
You can use the Operation field in the Object Inspector to rename the method. A dialog box appears asking if you want to create a new method or rename the old one.
If the recipient object is associated with an interface, only methods can be associated with the message link.
If a Method is selected, the label is Method<n> ():return_type.
If a Destructor is selected, the label is ~<Classname>(). The Destructor option is disabled in the submenu of the Add command.
You can use the Operation field in the Object Inspector to create a new method in the classifier. For example, in the Operation field, you can enter method_name(parameter_types):return_type. Entering parameter_types is optional. If the method does not exist in the class, a dialog opens prompting you to create it. If the method already exists in the class, the message link is automatically set for that method.
If you choose to associate a different classifier for an object that is already instantiated with a classifier, all of the message links where the Operation property has been set are automatically saved as text unless the method signature matches another method signature within the newly-linked classifier.
If you unlink a classifier from an object and that object has incoming message links where the Operation property is set to a method of the unlinked classifier, a dialog opens prompting you to unlink the method from the message link or save it as text. Choosing the option to save as text places the Operation property in quotation marks and the operation displays in red on the diagram. The intent of this feature is to help users to preserve all of the signatures of any methods that have been linked to the message links. Upon instantiating the object with a class again, you can delete the quotation marks. This will open a dialog box prompting you to create the method if it does not exist in the linked classifier. A dialog box does not open if the signature of the method matches an existing method in the classifier.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|