templateclass cc { public: T3& derived() { return *static_cast (this); } void fun_cc() { derived().fun_c(); cout << "cc的函数" << endl; } }; template class cla_tes: public cc > { public: void fun_c() { cout << "cla的函数" << endl; } int* a ; double* b; int data; }; int main() { cla_tes cla{}; cla.fun_cc(); }
输出
cla的函数 cc的函数



