drawbacks to calling Sprite::setTexture() later after instantiation?

drawbacks to calling Sprite::setTexture() later after instantiation?
0.0 0



I had a question regarding something I am doing to render Sprite nodes whose children must be able to render within a SpriteBatchNode.

I have an object which I have sub-classed from Sprite because I want it to contain child Sprite nodes that can be used as part of a SpriteBatchNode.
My object itself does not use a texture, it is used as a container for the child Sprite nodes. The only reason it extends Sprite, is so that it can be added as a child of SpriteBatchNode and have its own child nodes use the texture atlas.

My object can be conditionally added to different SpriteBatchNode parents, (e.g. a global SpriteBatchNode, or a level specific SpriteBatchNode). But if I try and add the Sprite that was not initialized with any texture to a SpriteBatchNode, cocos2dx complains the texture ids do not match.
My solution is set the texture just before adding it to the parent

Sprite* mySprite = Sprite::create(); //no file/texture 

Does doing this incur any bad side-effects? Is this sub-optimal for performance?

Thanks for the help