References in initializer list
<p>I have a camera class with two reference variables. I want to pass in two references through the constructor and assign the reference variables to these, so that if I change these in this class, the other ones I defined before (and passed in) will change too. However, I get the error:</p>

<pre><code>a reference of type "D3DXMATRIX &amp;" (not const-qualified) cannot be initialized with a value of type "D3DMATRIX"
</code></pre>

<p>and</p>

<pre><code>error C2440: 'initializing' : cannot convert from 'D3DMATRIX' to 'D3DXMATRIX &amp;'
</code></pre>

<p>here is my code:</p>

<p>header:</p>

<pre><code>#ifndef CAMERA_H
#define CAMERA_H

#include &lt;d3d10.h&gt;
#include &lt;d3dx10.h&gt;   
#include "globals.h"
#include "direct3D.h"

class Camera
{
private:
D3DXMATRIX &amp;matProjection, &amp;matView;
public:
Camera(
    float fOVDeg, float nearCull, float farCull,
    float xPos, float yPos, float zPos,
    D3DMATRIX &amp;matProjection, D3DMATRIX &amp;matView);
void SetCamera(float fOVDeg, float nearCull, float farCull);
void AdjustCamera(float x, float y, float z);
};

#endif
</code></pre>

<p>source:</p>

<pre><code>#include "Camera.h"

Camera::Camera(
float fOVDeg, float nearCull, float farCull,
float xPos, float yPos, float zPos,
D3DMATRIX &amp;matProjection, D3DMATRIX &amp;matView) 
: matProjection(matProjection), matView(matView)
{
this-&gt;SetCamera(fOVDeg, nearCull, farCull);
this-&gt;AdjustCamera(xPos, yPos, zPos);
}

// Set the fixed properties of the 3D camera
void Camera::SetCamera(float fOVDeg, float nearCull, float farCull)
{
// create a projection matrix
D3DXMatrixPerspectiveFovLH(
    &amp;matProjection,
    (float)D3DXToRadian(fOVDeg),    // the horizontal field of view
    (FLOAT)SCREEN_WIDTH / (FLOAT)SCREEN_HEIGHT, // aspect ratio
    nearCull,    // the near view-plane
    farCull);    // the far view-plane
}

// Set the adjustable properties of the 3D camera
void Camera::AdjustCamera(float x, float y, float z)
{
D3DXMatrixLookAtLH(&amp;matView,
                   &amp;D3DXVECTOR3 (x, y, z),
                   &amp;D3DXVECTOR3 (0.0f, 0.0f, 0.0f),
                   &amp;D3DXVECTOR3 (0.0f, 1.0f, 0.0f));
}
</code></pre>

<p>Obviously I am misunderstanding something fundamental. Any help would be greatly appreciated!</p>

<p>The errors I get are on the initialiser list in the constructor.</p>

<p>here is where I am instantiating the camera:</p>

<pre><code>Camera* camera;
D3DMATRIX matProjection, matView;

//called once
void Initialise(HWND hWnd)
{
initD3D(hWnd);
    init_pipeline();
cube = new Cube();

level = new Level(*cube);

camera = new Camera(
    45.0f, 1.0f, 10000.0f,
    0.0f, 9.0f, 100.0f,
    matProjection, matView);

test = 0.0f;
}
</code></pre>
