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

ဆိုလာ စနစ္ရွိ BATTERY AMPACITY အား design ထုတ္တြက္ခ်က္ၿခင္း (1) watt hour ရယူၿခင္း

Pointer to object array