11.7 別のインタフェースを継承するインタフェースのIDLでの指定

IDLでは,別のインタフェースを継承するインタフェースを指定できます。IDLコンパイラによって生成されるクラスは,この継承関係を反映します。親インタフェースが宣言したすべてのメソッド,データ型定義,定数,および列挙体は,派生インタフェースからも参照できます。

IDLサンプル11-4 インタフェース定義での継承の例

interface parent {
  void operation1();
};
interface child : parent {
  . . .
  long operation2(in short s);
};

コードサンプル11-15,11-16はIDLサンプル11-4に示すインタフェース定義から生成されたC++コードおよびJavaコードを示しています。

コードサンプル11-15 IDLサンプル11-4から生成されたコード(C++)

. . .
class parent : public virtual CORBA::Object {
  . . .
  void operation1();
  . . .
};

class child : public virtual parent {
  . . .
  CORBA::Long operation2(CORBA::Short s);
  . . .
};

コードサンプル11-16 IDLサンプル11-4から生成されたコード(Java)

public interface parentOperations {
  public void operation1 ();
}
public interface childOperations extends parentOperations {
  public int operation2 (short s);
}
public interface parent extends
         com.inprise.vbroker.CORBA.Object, parentOperations,
         org.omg.CORBA.portable.IDLEntity {
}
public interface child extends childOperations, Baz.parent,
         org.omg.CORBA.portable.IDLEntity {
}