class Person
{
public:
// constructor
Person(const std::string& name)
: m_name(name)
{}
// accessors for private members
std::string name() const { return m_name; }
void setName(const std::string& name) { m_name = name; }
// public members
float height;
unsigned int shoeSize;
// member function
bool hasBigFeet() const { return shoeSize > 10; } // U.K.!
private:
std::string m_name;
};
PONDER_TYPE(Person) // declare the type to Ponder
static void declare() // declare the class members to Ponder
{
ponder::Class::declare<Person>("Person")
.constructor<std::string>()
.property("name", &Person::name, &Person::setName)
.property("height", &Person::height)
.property("shoeSize", &Person::shoeSize)
.function("hasBigFeet", &Person::hasBigFeet)
;
}
int main(){
declare();
const ponder::Class& metaclass = ponder::classByType<Person>();
ponder::UserObject data = ponder::runtime::create(metaclass, "Tom");
//auto value = data.get("m_value");
//std::cout << value << std::endl;
//data.set("m_value", 1000);
return 0;
}
I compiled the demo code but got the following error:
undefined reference to `ponder::runtime::ObjectFactory::construct(ponder::Args const&, void*) const'
I compiled the demo code but got the following error: undefined reference to `ponder::runtime::ObjectFactory::construct(ponder::Args const&, void*) const'