G
girays
Hello everyone,
I have a simple problem what I don't know the exact syntac for this.
My code is shown below:
enum LengthType
{
LENGTH_METER = 0,
LENGTH_KMETER,
LENGTH_YARD, // 1 yard = 0,914 meter
LENGTH_KYARD
};
template <LengthType L>
class Length
{
public:
Length(void);
~Length(void);
// Length<toType> convertTo(LengthType toType) const; ???????
private:
LengthType m_type;
float m_value;
};
template <LengthType L>
Length<L>::Length( void )
: m_type(L)
, m_value()
{
}
You can see the lined marked ??????? at the end of line. I want to
convert from one Length object to another Length object. How can I
write this simple (may be not simple but I don't know how to do with
template code) code?
Thanks, regards ...
I have a simple problem what I don't know the exact syntac for this.
My code is shown below:
enum LengthType
{
LENGTH_METER = 0,
LENGTH_KMETER,
LENGTH_YARD, // 1 yard = 0,914 meter
LENGTH_KYARD
};
template <LengthType L>
class Length
{
public:
Length(void);
~Length(void);
// Length<toType> convertTo(LengthType toType) const; ???????
private:
LengthType m_type;
float m_value;
};
template <LengthType L>
Length<L>::Length( void )
: m_type(L)
, m_value()
{
}
You can see the lined marked ??????? at the end of line. I want to
convert from one Length object to another Length object. How can I
write this simple (may be not simple but I don't know how to do with
template code) code?
Thanks, regards ...