Apple Developer Connection
Advanced Search
Member Login Log In | Not a Member? Contact ADC

< 前ページ次ページ >

正式なプロトコル

正式プロトコルは、 @protocolディレクティブを使って宣言します。

@protocol ProtocolName < protocol list >
method declarations
@end

取り込むプロトコルのリストとメソッドの宣言は省略可能です。プロトコルは、それが取り込むプロトコルを宣言しているすべてのヘッダファイルをインポートする必要があります。

次の方法で@protocolディレクティブを使って、プロトコルの前方参照を作成できます。

@protocol ProtocolName;

ソースコード内では、プロトコルは同様の@protocol()ディレクティブを使って参照します(括弧内にプロトコル名を指定します)。

不等号括弧(<...>)で囲んで指定したリストのプロトコル名には、次の3つの異なる用途があります。

プロトコルの宣言内では、次の型修飾子がリモートメッセージングをサポートします。

型修飾子

定義

oneway

対象メソッドは非同期メッセージ用であり、有効な戻り値の型はありません。

in

対象引数は、リモートの受信者に情報を受け渡します。

out

対象引数は、参照によって戻される情報を取得します。

inout

対象引数は、情報の受け渡しと取得の両方を行います。

bycopy

オブジェクトの代理ではなくコピーを渡します(または戻されます)。

byref

オブジェクトのコピーではなく参照を渡します(または戻されます)。



< 前ページ次ページ >


Last updated: 2007-10-31




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice