隐藏,引用父类的虚函数

               

// testdev.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;class A{public: A()  {  cout << "A::A()" << endl;; } ~A() {  cout << "A::~A()" << endl; }public: virtual void fun(int n) {  cout << "A::fun()" << endl; }};class B:public A{public: B()  {  cout << "B::B()" << endl;; } ~B() {  cout << "B::~B()" << endl; }public: using A::fun; void fun() {  cout << "B::fun()" << endl; }};int _tmain(int argc, _TCHAR* argv[]){ B b; b.fun(1); return 0;} 

           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

猜你喜欢

转载自blog.csdn.net/yrryyff/article/details/87872609