#ifndef EVARCLASSPROPERTY_H
#define EVARCLASSPROPERTY_H

#include "eutils.h"

class evar;
class evarBase;

class eclassPropertyBase
{
 public:
  const type_info* fValue;
  virtual ~eclassPropertyBase() {}
  virtual evar operator()(evarBase* var)=0;
};

template <class T,class P>
class eclassProperty : public eclassPropertyBase
{
 public:
  P T:: *property;
  eclassProperty(P T:: *property,const estr& propertyname,const estr& info);
  virtual evar operator()(evarBase* var);
};

#include "evar_dec.h"

template <class T,class P>
eclassProperty<T,P>::eclassProperty(P T:: *_property,const estr& propertyname,const estr& info): property(_property) { fValue=&typeid(P); }

template <class T,class P>
evar eclassProperty<T,P>::operator()(evarBase* var)
{
  return(evarRef<P>((dynamic_cast<evarType<T>*>(var)->object)->*property));
}

#endif

