#include <iostream>
using namespace std;
class Soma{
public:
Soma(){n=0;}
static int Num_Static(){ //Static Member
num++;
return num;
}
int Num_Normal(){ //Normal Member
n++;
return n;
}
private:
static int num;
int n;
};
int Soma::num = 0;
int main(){
Soma a;
cout << "Static "<< a.Num_Static() << " and not static "<< a.Num_Normal()<< endl;
Soma* b = new Soma();
cout << "Static "<< b->Num_Static()<< " and not static "<< b->Num_Normal()<< endl;
Soma* c = new Soma();
cout << "Static "<< c->Num_Static()<< " and not static "<< c->Num_Normal()<< endl;
}
Nenhum comentário:
Postar um comentário