base.c 1/6
[top][prev][next]
#include "base.h"
static int dummy = ;
int Base_foo ( Base *this, int a ){
this->foo(this, a);
}
int Base_bar ( Base *this, int xint y ){
this->bar(this, x, y);
}
base.h 2/6
[top][prev][next]
#ifndef __BASE_H__
#define __BASE_H__
#define BASE(OBJ) ((Base*)OBJ)
#ifndef String
#define String char*
#endif
// Abstract
typedef struct _Base Base;
struct _Base {
/** Attributes **/
/*private*/
int x;
/** Associations **/
/** Operations **/
/*public*/
int (*foo) ( Base *this, int a );
/*protected*/
int (*bar) ( Base *this, int x, int y );
};
/** Operations **/
/*public*/
int Base_foo ( Base *this, int a );
/*protected*/
int Base_bar ( Base *this, int x, int y );
#endif
derived.c 3/6
[top][prev][next]
#include "derived.h"
int Derived_foo ( Derived *this, int a ){
}
int Derived_newfoo ( ){
}
int Derived_otherfoo ( Derived *this ){
}
int Derived_bar ( Derived *this, int x, int y ){
}
derived.h 4/6
[top][prev][next]
#ifndef __DERIVED_H__
#define __DERIVED_H__
#define DERIVED(OBJ) ((Derived*)OBJ)
#ifndef String
#define String char*
#endif
#include "pureabstract.h"
#include "base.h"
typedef struct _Derived Derived;
struct _Derived {
Base super;
/** Attributes **/
/** Associations **/
/** Operations **/
};
/** Operations **/
/*public*/
int Derived_foo ( Derived *this, int a );
int Derived_newfoo ( );
int Derived_otherfoo ( Derived *this );
/*protected*/
int Derived_bar ( Derived *this, int x, int y );
#endif
pureabstract.c 5/6
[top][prev][next]
#include "pureabstract.h"
int PureAbstract_otherfoo ( PureAbstract *this ){
this->otherfoo(this);
}
pureabstract.h 6/6
[top][prev][next]
#ifndef __PUREABSTRACT_H__
#define __PUREABSTRACT_H__
#define PUREABSTRACT(OBJ) ((PureAbstract*)OBJ)
#ifndef String
#define String char*
#endif
// Interface
typedef struct _PureAbstract PureAbstract;
struct _PureAbstract {
/** Attributes **/
/** Associations **/
/** Operations **/
/*public*/
int (*otherfoo) ( PureAbstract *this );
};
/** Operations **/
/*public*/
int PureAbstract_otherfoo ( PureAbstract *this );
#endif
Generated by GNU enscript 1.6.1.