C
Christopher
How can I assign a reference to another reference, making them both
refer to the same object?
The object does not have an assignment operator. Nor do I want to
assign right hand to left hand by value, I want two references to the
same object.
#ifndef RENDERABLE_H
#define RENDERABLE_H
// EngineX Includes
#include "Graphics\3D\Transform.h"
#include "Graphics\Effects\EffectManager.h"
// DirectX Includes
#include <d3d10.h>
#include <d3dx10.h>
// Boost Includes
#include <boost/shared_ptr.hpp>
// Standard Includes
#include <string>
//----------------------------------------------------------------------------------------------------------------------
class Renderable : public Transform
{
public:
// SNIP
Renderable & operator = (const Renderable & rhs);
// SNIP
protected:
RenderType m_renderType; // Determines
how to queue renderables (see Renderqueue.h)
ID3D10Device & m_device; // D3D device
EffectManager & m_effectManager; // Contains
and creates effects and techniques
std::string m_effectName; // Name of
the effect to use when rendering
std::string m_techniqueName; // Name of
the technique to use when rendering
std::auto_ptr<Material> m_material; // Material
hold all effect variable values to use when rendering
private:
};
#endif RENDERABLE_H
//----------------------------------------------------------------------------------------------------------------------
Renderable & Renderable:perator = (const Renderable & rhs)
{
if( this == &rhs )
{
return *this;
}
this->Transform:perator = (rhs);
// Error Here
m_device = rhs.m_device;
m_effectManager = rhs.m_effectManager;
m_renderType = rhs.m_renderType;
return *this;
}
refer to the same object?
The object does not have an assignment operator. Nor do I want to
assign right hand to left hand by value, I want two references to the
same object.
#ifndef RENDERABLE_H
#define RENDERABLE_H
// EngineX Includes
#include "Graphics\3D\Transform.h"
#include "Graphics\Effects\EffectManager.h"
// DirectX Includes
#include <d3d10.h>
#include <d3dx10.h>
// Boost Includes
#include <boost/shared_ptr.hpp>
// Standard Includes
#include <string>
//----------------------------------------------------------------------------------------------------------------------
class Renderable : public Transform
{
public:
// SNIP
Renderable & operator = (const Renderable & rhs);
// SNIP
protected:
RenderType m_renderType; // Determines
how to queue renderables (see Renderqueue.h)
ID3D10Device & m_device; // D3D device
EffectManager & m_effectManager; // Contains
and creates effects and techniques
std::string m_effectName; // Name of
the effect to use when rendering
std::string m_techniqueName; // Name of
the technique to use when rendering
std::auto_ptr<Material> m_material; // Material
hold all effect variable values to use when rendering
private:
};
#endif RENDERABLE_H
//----------------------------------------------------------------------------------------------------------------------
Renderable & Renderable:perator = (const Renderable & rhs)
{
if( this == &rhs )
{
return *this;
}
this->Transform:perator = (rhs);
// Error Here
m_device = rhs.m_device;
m_effectManager = rhs.m_effectManager;
m_renderType = rhs.m_renderType;
return *this;
}