So I have been encountering a number of annoying design decesions, because I want to initialize my objects with the constructor.
Sounds weird but let me explain: Say I have a class A and class B. Class B manages multiple instances of A, but A depends on an initialized object of B.
Here is a concrete simplified example from my code:
class Renderer {
private:
ID3D11Device* device;
ConstantBuffer cbuffer;
}
class ConstantBuffer {
public:
ConstantBuffer(ID3D11Device* device);
}
So the issue in this case is that cbuffer needs an initialized ID3D11Device in its constructor. I hope the problem is kind of clear now.
How do you get around this issue without using pointers? Or is this just a design flaw on my side?