#include"A.h"#include<iostream>usingnamespace std;void A::show(int a){
cout <<"A::show(int a) = "<< a << endl;}
#include"A.h"classB:public A {public:voidshow(int a,int b);};
#include"B.h"#ifndef _B_H_#define _B_H_#include<iostream>usingnamespace std;void B::show(int a,int b){
cout <<" B::show(int a, int b) = "<< a << endl;}#endif
#include"A.h"#include"B.h"/*隐藏:是指派生类的函数屏蔽了与其同名的基类函数,注意只要同名函数,不管参数列表是否相同,基类函数都会被隐藏。*/voidfun(){
B b;
b.show(1,2);//b.show(3);错
A *a =&b;
a->show(3);//a->show(4,5);错}intmain(){fun();return0;}