Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "MyClass.h"
- // ここにプロトタイプ書くことで見えなくする。
- void MyClass_method(MyClass* this, int a);
- int MyClass_func(MyClass* this, int arg);
- void MyClass_constructor(MyClass* this) {
- // スーパークラスのコンストラクト
- MySuper_constructor((MySuper*)this);
- // MyClassのコンストラクト
- this->mem = 10;
- this->method = MyClass_method;
- this->func = MyClass_func;
- }
- void MyClass_method(MyClass* this, int a){
- this->mem += a;
- return;
- }
- // オーバーライドする
- int MyClass_func(MyClass* this, int arg) {
- // スーパークラスの処理
- int res = ((MySuper*)this)->func((MySuper*)this, arg);
- return res * res;
- }
Add Comment
Please, Sign In to add comment