J
joe
Curious if this type of construct has a name, or is a recognized
design pattern:
class Function
{
public:
Function() { // do loads of work here in the Constructor, store result
in m_result }
operator double() { return m_result;} //Automatic Type Conversion
private:
double m_result;
};
with the expected simple usage:
double value = Function();
Is there some recognized caveat to the above? I don't see it used
very often.
design pattern:
class Function
{
public:
Function() { // do loads of work here in the Constructor, store result
in m_result }
operator double() { return m_result;} //Automatic Type Conversion
private:
double m_result;
};
with the expected simple usage:
double value = Function();
Is there some recognized caveat to the above? I don't see it used
very often.