#include
Virtual showdemo () const = 0;}; 2. Stripping abstract business is put into public class 3. Let Derived1, Derived2 inherit from BASE. 4. Subclas must implement interface functions <2> Take payment when using The parameters of the function can only use the base & or base * to pass the object address, so that it is found in the runtime discriminant type 2. Each inherits adds a virtual table to increase resource overhead. * / class derived1 {public: void showdemo () const {cout << "Derived1 :: showdemo ()" << endl;}};
Class deived2 {public: void showdemo () const {cout << "Derived2 :: showdemo ()" << endl;}};
// Use the template to interpret the solid-ginseng, the object type of the identified object directly in the runtime period / / only uses a generic, less than the SHOWDEMO, but it is actually instantified twice // because it is only for this whole The class uses a generic, but if the incoming T is other type / / static detection, it will find problems, discovery that the structure does not this function Template
Template
Template Void main () { Derived1 t_d_1; derived2 t_d_2; ShowDemo (T_D_2); showdemo (t_d_1); Effeceach (t_d_1, t_d_2); Vector