home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_07 / 9n07058a < prev    next >
Text File  |  1991-05-02  |  767b  |  36 lines

  1.  
  2. class Frog {
  3. public:
  4.       Frog( char *Name)     
  5.       { 
  6.             name = Name;
  7.             count++;
  8.       }
  9.       
  10.       ~Frog()      { count--; }
  11.                   
  12.       // instance interface
  13.       void jump()   { distance += 100; }
  14.       void hop()    { distance += 50; }
  15.       void skip()   { distance += 25; }
  16.       void swim()   { distance += 25; }
  17.       void print()  
  18.       { 
  19.           printf( "Frog name is %s, 
  20.              distance from pond is %d\n" ); 
  21.       }
  22.  
  23.       // type-as-object interface
  24.       // new ...
  25.       // sizeof
  26.       static int howmany() { return count; }
  27. private:
  28.       // instance variables
  29.       int distance;
  30.       char *name;
  31.  
  32.       // type-as-object variables
  33.       static int count;
  34. };
  35.  
  36.