#include template class One { public: One() {} ~One() {} void fn() { std::cout << "One: primary" << std::endl; } private: T _t; }; template<> class One { public: One() {} ~One() {} void fn() { std::cout << "One: specialization" << std::endl; } private: char _c; }; template class Two { public: Two() {} ~Two() {} void fn() { std::cout << "Two: primary" << std::endl; } private: T1 _t1; T2 _t2; }; template class Two { public: Two() {} ~Two() {} void fn() { std::cout << "Two: specialization" << std::endl; } private: T _t; char _c; }; template class Two { public: Two() {} ~Two() {} void fn() { std::cout << "Two: specialization" << std::endl; } private: T _t; T* _pt; }; template class Two { public: Two() {} ~Two() {} void fn() { std::cout << "Two: specialization" << std::endl; } private: T _t; }; template class Two { public: Two() {} ~Two() {} void fn() { std::cout << "Two: specialization" << std::endl; } private: T _t; }; template<> class Two { public: Two() {} ~Two() {} void fn() { std::cout << "Two: specialization" << std::endl; } private: char _c; }; template<> class Two { public: Two() {} ~Two() {} void fn() { std::cout << "Two: specialization" << std::endl; } private: char _c; }; template<> class Two { public: Two() {} ~Two() {} void fn() { std::cout << "Two: specialization" << std::endl; } private: char _c; }; template class TwoSz { public: TwoSz() {} ~TwoSz() {} void fn() { std::cout << "TwoSz: primary" << std::endl; } private: T1 _t1; }; template class TwoSz { public: TwoSz() {} ~TwoSz() {} void fn() { std::cout << "TwoSz: specialization" << std::endl; } private: T _t1; }; class Base1 {}; template class Base2 {}; template class Derived : public Base1, Base2 { public: Derived() {} }; int main() { One oneInt; oneInt.fn(); One oneChar; oneChar.fn(); Two twoIntInt; twoIntInt.fn(); Two twoIntChar; twoIntChar.fn(); Two twoIntIntP; twoIntIntP.fn(); Two twoIntIntR; twoIntIntR.fn(); Two twoIntIntA; twoIntIntA.fn(); Two twoCharCharP; twoCharCharP.fn(); Two twoCharCharR; twoCharCharR.fn(); Two twoCharCharA; twoCharCharA.fn(); TwoSz twoSzInt8; twoSzInt8.fn(); TwoSz twoSzIntSizeofI; twoSzIntSizeofI.fn(); Derived derived{}; return 0; }