Home > Back-end > Should not be: call the function is the actual point to a member function of the type of an object,
Should not be: call the function is the actual point to a member function of the type of an object,
Time:10-18
The class Base { Public: Virtual void f (float x) {cout & lt; <"Base: : f (float)" & lt; Void g (float x) {cout & lt; <"Base: : g (float)" & lt; Void h (float x) {cout & lt; <"Base: : h (float)" & lt; };
The class Derived: public Base { Public: Virtual void f (float x) {cout & lt; <"Derived: : f (float)" & lt; Void g (int x) {cout & lt; <"Derived: : g (int)" & lt; Void h (float x) {cout & lt; <"Derived: : h (float)" & lt; }; Int main () { Derived d; The Base * pb=& amp; d; Pb - & gt; F (3.14 f);//Derived: : f (float) 3.14 Pb - & gt; G (3.14 f);//Base: : g (float) 3.14 Pb - & gt; H (3.14 f);//Base: : h (float) 3.14 return 0; }
Should not be: call the function is the actual point to a member function of the type of an object, rather than a member function pointer type? How to g and h the base class of functions,