whaen i create objects of the clas i wish to increment each counter simultanously now problem is that if the int is defined by value the counter never increments. if by reference it would be the same counter for all objects? how can i solve this?
use a class like this class B { A obj; int counter; } instead of creating objects of class A , create obj of class B
Обсуждают сегодня