[英]member function pointer to member function
關於成員函數的指針有很多討論,但是我很難理解成員函數的隱藏const狀態的問題。 誰能給我一個簡單的答案,我在這里做錯了什么?
class Entity
{
public:
Entity();
void(Entity::*update_function)();
private:
void update_mode_1() {
}
};
Entity::Entity()
{
update_function = update_mode_1;
//error C3867: 'Entity::update_mode1': non-standard syntax; use '&' to create a pointer to member
}
void test_init() {
Entity obj;
obj.update_function();
//Error: Expression preceding parenthesis of apparent call must have (pointer-to-) function type
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.