How do I send `this` as a parameter?

This is my code currently in main:

std::shared_ptr<CEntity> Player;

CCamera Camera = Camera(this, Player);

And this is CCamera:

CCamera(CGame* Parent, std::shared_ptr<CEntity> Target);

This is the error I get:

|error: no match for call to '(CCamera) (CGame* const, std::shared_ptr<CEntity>&)'|

How do I fix this?
If you are doing this inside a const member function this will give you a const CGame*.
CCamera Camera = Camera(this, Player);
Did you mean to write:
CCamera Camera (this, Player);
Yes thank you that was the problem. And also I had to make it a pointer and define it later after Player has been defined.
Topic archived. No new replies allowed.