All pastes #387931 Raw Edit

Unnamed

public cpp v1 · immutable
·published 2007-03-09 18:47 UTC
rendered paste body
// static members in classes#include <iostream>using namespace std;class CDummy {  public:    static int n;    CDummy () { n++; };    CDummy (int r, int e) { n += (r + e); };    ~CDummy () { n--; };};int CDummy::n=0;int main (int argc, char argv[]) {  if(argc < 3) {    cout << "[USAGE]test arg1 arg2" << endl;   } else {    CDummy d(argv[1], argv[2]);    cout << CDummy::n << endl;    }  return 0;}