I am trying to print out xx, yy values of an object which gets those values from a generator class where I assign them. For example:
Object.h
class Object {
public:
  // Define default constructors as this is an abstract class
  Object() = default;
  Object(const Object&) = default;
  Object(Object&&) = default;
  virtual ~Object() {};
  // Object properties
  glm::vec3 position{0,0,0};
  glm::vec3 rotation{0,0,0};
  /* I tried to define those variables here instead 
  of defining in cube.h but on print, values are never changed. */
  //int xx=-1;
  //int yy=-1;
protected:
  void generateModelMatrix();
};
Cube.h:
#include "object.h"
class Cube final : public Object{
private:
   //some code
public:
   int xx=-1;
   int yy=-1;
   Cube();
private:
};
Generator.cpp
#include "cube.h"
bool Generator::update() {
   for (int x = 0; x < 5; ++x) {
       for (int y = 0; y < 5; ++y) {
          auto obj = make_unique<Cube>();
          obj->position.x += 2.1f * (float) x - 4.0f; //this works fine
          obj->xx = x;   //In this case, I get debugger error for xx: -var-create: unable to create variable object.
          obj->yy = y;   //same error here
       }
    if(x==4) return false;
   }
return true;
}
Cube.cpp
#include "cube.h"
Cube::Cube(){
   printf("x: %d, y: %d\n", xx, yy);
}
And in class Cube I tried to print out xx and yy values and I get -1 for every object, obviously it is not assigning those values at all. What did I do wrong?
 
    