Hahaahahahaha!!! I did that exact same thing on the empty constructor, thinking it would work the exact same, but it didn't, as doing that solved the issue. So why doesn't it work with the empty constructor? Here's a piece of implementation to show what I'm asking.
Code: Select all
struct IndexBuffer
{
ID3D11IndexBuffer * ib;
UINT size;
IndexBuffer():ib(0){}
IndexBuffer(UINT s,IndexBuffer i)
{
size = s;
ib = i;
}
IndexBuffer(UINT s)
{
size = s;
}
}
class someclass
{
IndexBuffer ib;//does this not call the empty constructor? it requires that I have one if I do this
public:
someclass()
{
ib = IndexBuffer(500);
}
}
ohh I think I figured it out. When I first declare the ib object, it DOES work as intended, and sets the pointer to 0, however, when I use the assignment operator, the IndexBuffer(500) object DOESN'T have the pointer set to 0, and then when it copies the variables over, it copies over the 0 and puts an undefined variable in its place.
Oh and short, you said if I had more context it might help to solve my problem, so I joked about adding more Context objects to the program