#include <iostream>
#include <vector>
#include <string>
class MyClass {
public:
MyClass(std::string s, int i) {
StringValue = s;
IntValue = i;
}
std::string StringValue;
int IntValue;
};
void addInstance(std::vector<MyClass*>& MyVector, int i) {
MyClass c("", i);
MyVector.push_back(&c);
}
int main() {
std::vector<MyClass*> MyVector;
//MyClass c1("CLASS 1", 1);
//MyClass c2("CLASS 2", 2);
addInstance(MyVector, 1);
addInstance(MyVector, 2);
//MyVector.push_back(&c1);
//MyVector.push_back(&c2);
std::cout << MyVector[0]->IntValue << ", " << MyVector[1]->IntValue;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgogCmNsYXNzIE15Q2xhc3MgewpwdWJsaWM6CiAgICBNeUNsYXNzKHN0ZDo6c3RyaW5nIHMsIGludCBpKSB7CiAgICAgICAgU3RyaW5nVmFsdWUgPSBzOwogICAgICAgIEludFZhbHVlID0gaTsKICAgIH0KIAogICAgc3RkOjpzdHJpbmcgU3RyaW5nVmFsdWU7CiAgICBpbnQgSW50VmFsdWU7Cn07Cgp2b2lkIGFkZEluc3RhbmNlKHN0ZDo6dmVjdG9yPE15Q2xhc3MqPiYgTXlWZWN0b3IsIGludCBpKSB7CglNeUNsYXNzIGMoIiIsIGkpOwoJTXlWZWN0b3IucHVzaF9iYWNrKCZjKTsKfQoKaW50IG1haW4oKSB7CglzdGQ6OnZlY3RvcjxNeUNsYXNzKj4gTXlWZWN0b3I7CgkvL015Q2xhc3MgYzEoIkNMQVNTIDEiLCAxKTsKCS8vTXlDbGFzcyBjMigiQ0xBU1MgMiIsIDIpOwoJYWRkSW5zdGFuY2UoTXlWZWN0b3IsIDEpOwoJYWRkSW5zdGFuY2UoTXlWZWN0b3IsIDIpOwogCgkvL015VmVjdG9yLnB1c2hfYmFjaygmYzEpOwoJLy9NeVZlY3Rvci5wdXNoX2JhY2soJmMyKTsKCXN0ZDo6Y291dCA8PCBNeVZlY3RvclswXS0+SW50VmFsdWUgPDwgIiwgIiA8PCBNeVZlY3RvclsxXS0+SW50VmFsdWU7CglyZXR1cm4gMDsKfQ==