Image constructor


photo

Recommended Posts

Bunch of classes inherited from APIInterface like Image, Texture, etc. have both constructor and `Ptr<T> create()` function.

So, the question is - can I use C++ constructor for them? Are they stack or heap based?

What happens when copy constructor occurs? Is it value copy, or just some internal pointer copy?

Link to post

Hmmm... I see now - C++ constructors not working with these classes.

So the question is - why constructors are exposed?

 

First of all this makes current API ambiguous, second - you have a possibility of human-error.

 

P.S. If you need constructors to be public in order to construct object with your smart pointer... I'm sure this can be managed.

Link to post