Witam, uczę się c++ i mam problem z classami. Napisałem sobie programik aby zrozumieć zmienna statyczną, ale nie działa, próbowałem już wielu trików ale nic.
#include <iostream.h>
class test {
public:
int jeden;
static int dwa;
test() {
jeden++;
dwa++;
}
};
main()
{
test he, heh;
cout << he.jeden << he.dwa << endl;
cout << heh.jeden << heh.dwa << endl;
test hehe;
cout << hehe.jeden << hehe.dwa << endl;
system("PAUSE");
}
Wiem że to tylko wyświetlanie, ale o to mi chodzi. :P