In case it was not clear from above posts - you are
NOT ALLOWED to call any method on object (like create/setTexture/whatever) unless constructor was invoked. Either implicitly by compiler, or explicitly by placement new syntax. There is exception where you can do, but you shouldn't rely on that (class has no vtable, and no members in its or its parent classes which have constructors).
Instead of randomly trying bunch of methods, you should really be reading source to understand what they are doing and do same things but with your "push" method. I don't know what is your Sprite or Texture2D class, so I can not comment on this more.
If constructor is private then it typically means there is public static method to construct object:
| class Object
{
private:
Object() { ... } // private constructor
public:
static Object* Create(..arguments..) // public method
{
return new Object(...);
}
};
|
In such case you will need to modify this static Create method to use your "push" and placement new syntax. There is no other good way to fix it.
There is another uglier solution - to put "#define private public" before including class declaration. Then all private methods will become public. But I don't recommend this. It is better to go and change class source code to do whatever you need it to do.