#include <iostream> using namespace std; class IParentCls { public: virtual void Print() = 0; }; class ChildCls : public IParentCls { public: void Print() { cout << "Child" << endl; } }; int main() { IParentCls * pInterface = new ChildCls; pInterface -> Print(); delete pInterface; return 0; }
C++面向接口的编程
最新推荐文章于 2022-08-01 15:21:12 发布