[ create a new paste ] login | about

Link: http://codepad.org/35U7dgRU    [ raw code | output | fork ]

C++, pasted on May 22:
#include <iostream>

using namespace std;

class TEST
{
    private :
            static int abc;
    public :
           TEST() {++abc;}
           TEST(const TEST& c) {++abc;}
           ~TEST() {--abc;}
           
           static int ob() {return abc;} 
};

int TEST::abc = 0;

int main()
{
    TEST a;
    for(int i = 0; i < 3; i++)
    {
        TEST b = a;
        cout << TEST::ob()<< endl;
    }
    cin.get();
    return 0;
}


Output:
1
2
3
2
2
2


Create a new paste based on this one


Comments: