#include <iostream>
using namespace std;
class AnotherObjectType {};
class A {
public:
A(){count = 0;};
int count;
private:
AnotherObjectType anotherObject;
};
A f(){
static A a;
a.count++;
//Other things...
return a;
}
int main() {
// your code goes here
A a;
for (int i = 0; i < 3; i++) {
a = f();
std::cout << "Count: " << a.count << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjbGFzcyBBbm90aGVyT2JqZWN0VHlwZSB7fTsKCmNsYXNzIEEgewpwdWJsaWM6CiAgIEEoKXtjb3VudCA9IDA7fTsKCWludCBjb3VudDsKcHJpdmF0ZToKICAgIEFub3RoZXJPYmplY3RUeXBlIGFub3RoZXJPYmplY3Q7Cn07CgogQSBmKCl7CiAgICBzdGF0aWMgQSBhOwogICAgYS5jb3VudCsrOwogICAgLy9PdGhlciB0aGluZ3MuLi4KICAgIHJldHVybiBhOwp9CgppbnQgbWFpbigpIHsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCUEgYTsKCWZvciAoaW50IGkgPSAwOyBpIDwgMzsgaSsrKSB7CgkJYSA9IGYoKTsKCQlzdGQ6OmNvdXQgPDwgIkNvdW50OiAiIDw8IGEuY291bnQgIDw8IHN0ZDo6ZW5kbDsKCX0KCXJldHVybiAwOwp9