示例#1
0
文件: method.hpp 项目: EricWF/entity
 /// This function shows how methods are typically defined and then added
 /// to an entity
 void add_default_print_name(entity & e)
 {
     /// the definition must have the exact ACTUAL SIGNATURE.
     auto print_name_def =
     [](entity const & self)
     {
         std::cout << "My name is " << to_string(self.id()) << std::endl;
     };
     
     /// Set the print_name_ method to use print_name_def when called
     e.set(print_name_, print_name_def);
 };