First page Back Continue Last page Overview Graphics

Clock Class with getTime()

%module Clock

%include "typemaps.i"

%apply int *OUTPUT { int &h, int &min, int &sec };

%{

#include "Clock.h"

%}

class Clock {

// …

// include code as before

void getTime(int &h,

int &min,

int &sec);

// ….

};

using the module:

>>> import Clock

>>> x = Clock.Clock(11,8,23)

>>> x.getTime()

[11, 8, 23]

>>> t = x.getTime()

>>> type(t)

<class 'list'>

>>>