1 /* File : example.cxx */
3 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
4 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
5 # define _CRT_SECURE_NO_DEPRECATE
12 Vector operator+(const Vector &a, const Vector &b) {
20 char *Vector::as_string() {
21 static char temp[512];
22 sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z);
26 VectorArray::VectorArray(int size) {
27 items = new Vector[size];
29 printf("VectorArray new: self=%p\n",this);
32 VectorArray::~VectorArray() {
33 printf("VectorArray delete: self=%p\n",this);
37 Vector &VectorArray::operator[](int index) {
38 printf("VectorArray: read[%d] self=%p\n",index,this);
39 if ((index < 0) || (index >= maxsize)) {
40 printf("Panic! Array index out of bounds.\n");
46 int VectorArray::size() {
47 printf("VectorArray: size %d self=%p\n",maxsize,this);