noob error and confused ?

Started by
2 comments, last by Serapth 12 years, 6 months ago


class CArc
{
private:

public:
float m_arcAngle;
CArc(){ m_arcAngle = 45;}
inline float GetArc() { return m_arcAngle;}
inline void SetArc(float amount) { m_arcAngle = amount;}
inline void UpdateArc(float amount) { m_arcAngle += amount;}
};




class CLightSpot :
public CBaseLight
{
private:
CArc Arc;
public:
CArc GetArc() { return Arc;}
CLightSpot(void);
~CLightSpot(void);

public:

};



CLightSpot* spotLight = new CLightSpot;

spotlight->GetArc().SetArc(90);

float tt = spotlight->GetArc().GetArc();

float tt will equal 45 , the original setting

can any one expplain how to set it correctly , with out making ARc arc into ARc* arc;

really confused
Advertisement
You could change CLightSpot::GetArc() to return a CArc & instead of a CArc.

You could change CLightSpot::GetArc() to return a CArc & instead of a CArc.




cheers mate , been at back off my mind for about 3 weeks. would not mind but designing a game engine and 3rd at uni doing it , lol
It is very key that you understand *why* SiCrane's recommendation worked if you don't already know. This is a very key concept in c++

This topic is closed to new replies.

Advertisement