In C + +, the overload between the parent class and the subclass, the function with the same name overrides, even if the parameter type is different and cannot be called directly, it must be called by the parent class's default generated object.
Test procedure:
#include <iostream>class a{public:void Fun () {std::cout<< ' A fun ' <<std::endl; void fun (int. num) {std::cout<< "A Fun" <<num<<std::endl;}}; Class B:public A{public:void Fun () {std::cout<< ' B fun ' <<std::endl;}}; void Main () {int num = 100; B B;b.fun ();//B.fun (num); Cannot invoke compile error, the same name function is overwritten even if the parameter type is different. B.a::fun (num);//Only Call Std::cin.get () through this method;}
void Fun () void fun (int num) in the parent class is overwritten with a class void fun ().
Overloading in the inheritance of C + +