C++ (Qt)struct A{ void print(){cout << "A" << endl;} };struct B{ void print(){cout << "B" << endl;} };struct B1: public B{ void print(){cout << "B1" << endl;} };struct B2: public B{ void print(){cout << "B2" << endl;} }; template< class U, typename E = void >struct T{ void print(){cout << "T<U>" << endl;} }; template<>struct T<A>{ void print(){cout << "T<A>" << endl;} }; template<class U>struct T<U, typename enable_if<is_base_of<B, U>::value>::type>{ void print(){cout << "T<B>" << endl;} }; int main(){ T<A> t_a; T<B> t_b; T<B1> t_b1; T<B2> t_b2; t_a.print(); t_b.print(); t_b1.print(); t_b2.print(); return 0;}
C++ (Qt)struct A{ void print(){cout << "A" << endl;} };struct B{ void print(){cout << "B" << endl;} };struct B1: public B{ void print(){cout << "B1" << endl;} };struct B2: public B{ void print(){cout << "B2" << endl;} };struct B21: public B2{ void print(){cout << "B21" << endl;} }; template< class U, typename E = void >struct T{ void print(){cout << "T<U>" << endl;} }; template<>struct T<A>{ void print(){cout << "T<A>" << endl;} }; template<class U>struct T<U, typename enable_if<is_base_of<B, U>::value>::type>{ void print(){cout << "T<B>" << endl;} }; template<class U>struct T<U, typename enable_if<is_base_of<B2, U>::value>::type>{ void print(){cout << "T<B2>" << endl;} }; int main(){ T<A> t_a; T<B> t_b; T<B1> t_b1; T<B2> t_b2; T<B21> t_b21; t_a.print(); t_b.print(); t_b1.print(); t_b2.print(); t_b21.print(); return 0;}
C++ (Qt)class A;class B; class C : public A, public B;class D: public C; template<class U>class T; template<>class T<A>; template<>class T<B>; T<D> - ???
C++ (Qt)struct A{ void print(){cout << "A" << endl;} };struct B{ void print(){cout << "B" << endl;} };struct B1: public B{ void print(){cout << "B1" << endl;} };struct B2: public B{ void print(){cout << "B2" << endl;} };struct B21: public B2{ void print(){cout << "B21" << endl;} }; template< class U, typename E = void >struct T{ void print(){cout << "T<U>" << endl;} }; template<>struct T<A>{ void print(){cout << "T<A>" << endl;} }; template<class U>struct T<U, typename enable_if<is_base_of<B, U>::value>::type>{ void print(){cout << "T<B>" << endl;} }; template<>struct T<B2>{ void print(){cout << "T<B2>" << endl;} }; template<>struct T<B21> : public T<B2>{}; int main(){ T<A> t_a; T<B> t_b; T<B1> t_b1; T<B2> t_b2; T<B21> t_b21; t_a.print(); t_b.print(); t_b1.print(); t_b2.print(); t_b21.print(); return 0;}
class C: public B, public A
template<class A>class T: public A{...stuff(); // A::stuff();...}