template <typename Container, typename ValueType, void (Container::*setptr)(ValueType t),ValueType (Container::*getptr)(), int nPropType=3>
class property
{
public:
property()
{
m_cObject= cObject;//aqui esta 1 problema:(
Set = setptr;
Get = getptr;
}
void setContainer(Container* cObject)
{
m_cObject = cObject;
}
//-- Overload the '=' sign to set the value using the set
// member --
ValueType operator =(const ValueType& value)
{
assert(m_cObject != NULL);
assert(Set != NULL);
(m_cObject->*Set)(value);
return value;
}
//-- To make possible to cast the property class to the
// internal type --
operator ValueType()
{
assert(m_cObject != NULL);
assert(Get != NULL);
return (m_cObject->*Get)();
}
friend istream &operator>>( istream &input, property &d )
{
ValueType v;
input >>v;
d = v;
return input;
}
friend istream& getline (istream& is, property &str)
{
ValueType v;
getline(is,v);
str = v;
return is;
}
private:
Container* m_cObject; //-- Pointer to the module that
// contains the property --
void (Container::*Set)(ValueType value);
//-- Pointer to set member function --
ValueType (Container::*Get)();
//-- Pointer to get member function --
};
(but i did the version 2;))
my question is: can i put these: