DIFF.BLOG
New
Following
Discover
Jobs
More
Suggest a blog
Upvotes plugin
Report bug
Contact
About
Sign up  
[C++]non-static member function as callback function and achieve inheritance
1
·
王爱国
·
June 30, 2018, 9:19 a.m.
Summary
keywords:C++ 非静态成员函数作为回调函数并实现继承多态 Base.hpp #pragma once class Base { public: virtual void TestFun1(int Param) {} virtual void TestFun2(int Param) {} }; Child.hpp #pragma once #include <iostream> #include "Base.hpp" class Child : public Base { public: void TestFun1(int Param) override { printf("Fun1 : %d\n", Param); } void TestFun2(int Param) override { printf("Fun2 : %d\n", Param); } }; EventManager.h // Fill out your copyright notice in the Description page of Project Settings....
Read full post on dawnarc.com →
Submit
AUTHOR
RECENT POSTS FROM THE AUTHOR