/* -*- C++ -*- */ /************************************************************************* * Copyright(c) 1995~2005 Masaharu Goto (root-cint@cern.ch) * * For the licensing terms see the file COPYING * ************************************************************************/ /************************************************************************** * array.c * * Simple Array class * * Constructor, copy constructor, destructor, operator overloading * function overloading, reference type * **************************************************************************/ #include #include #include int nstore; /********************************************************** * class array **********************************************************/ struct array { double *dat; int n; array(array& X); array(double x,int ndef); array(double x); ~array(); void print(void); void print(int n); array operator =(array& a); } ; array::~array() { // abc free(dat); // printf("destroyed\n"); } // Copy constructor array::array(array& X) { int i; // free(dat); dat = (double *)malloc(X.n*sizeof(double)); for(i=0;i