Drkcore

08 11 2006 perl SWIG Tweet

SWIGのシャドークラス

SWIG使ってフラクタル図形を書いた際にshadowってオプションをつけたのだけどよくわかってなかったのでちゃんと調べた(というか実用Perlプログラミングに書いてあったんだけど)。

C/C++のオブジェクトのメンバ属性、メンバ関数に対し、perlのハッシュ記法でアクセスできるようにするメカニズムだそうだ。

class Shape {
public:
    int x, y;
    int w, h;
    drwaw();
};
class Poligon : public Shape {
public:
    polygon(int x, int y, int w, int h);
    draw();
};

とやると

use Graphics;
$poly = new Polygon(10, 10, 30, 40);

print $poly->{x}, $poly->{y};

みたいにアクセスできるようにするオプションだそうだ。

ProductName 実用Perlプログラミング
スリラム スリニバサン
オライリー・ジャパン / ?円 ( 1998-11 )


About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021