would be used only from +thensimply run swig in your makefile to scan the +class declaration and compile and link its output the end result is that by importing the shadow class in your python scriptsyou can utilize +classes as though they were really coded in python not only can python programs make and use instances of the +classthey can also customize it by subclassing the generated shadow class simple +extension class to see how this workswe need +class to illustratelet' code one to be used in python scripts you have to understand +to make sense of this sectionof courseand swig supports advanced +tools (including templates and overloaded functions and operators)but 'll keep this example simple for illustration the following +files define number class with four methods (addsubsquareand display) data member (data)and constructor and destructor example - shows the header file example - pp \integrate\extend\swig\shadow\number class number publicnumber(int start)~number()void add(int value)void sub(int value)int square()void display()int data}/constructor /destructor /update data member /return value /print data member example - is the +class' implementation filemost methods print message when called to trace class operations notice how this uses printf instead of ++' coutthis once resolved an output overlap issue when mixing +cout with python standard output streams on cygwin it' probably moot point today--because python ' output system and buffering might mix with ++' arbitrarilyc+should generally flush the output stream (with fflush(stdoutor cout<<flushif it prints intermixed text that doesn' end in newline obscure but true when disparate language systems are mixed example - pp \integrate\extend\swig\shadow\number cxx ///////////////////////////////////////////////////////////////implement +classto be used from python code or not/caveatcout and print usually both workbut ran into / ++/py output overlap issue on cygwin that prompted printf //////////////////////////////////////////////////////////////#include "number #include "stdio /versus #include "iostream hwrapping +classes with swig