Static member function

 //static function 

#include<iostream.h>

class member{

private:

static int total;

int id;

public:

member()

{total+=1;

id=total;

cout<<"creating id "<<id<<endl;

}

~member()

{

// total-=1;

id=total;

total--;

cout<<"destroying id "<<id<<endl;

}

void show()

{

cout<<"total is"<<total;}

};


int member::total=0;

int main(int argc, char *argv[])

{

member a;

member b;

member c;

member d;

// a.show();

cout<<"**********"<<endl;

}

Comments

Popular posts from this blog

serial to parallel test with 74c595 and pic mcu

INTERRUPT_ON_CHANGE_18f4550