类的函数模班

 #include <iostream>

class UtilityTool{

public:

    template< typename alphabet_type>
    static void method1(){
        std::cout << __FUNCTION__ << ": sizeof(alphabet_type)=" << sizeof(alphabet_type) << std::endl;
    }

    template< typename offset_type>
    static void method2(){
        std::cout << __FUNCTION__ << ": sizeof(offset_type)=" << sizeof(offset_type) << std::endl;
    }


};


int main(){

    UtilityTool::method1<int>();

    UtilityTool::method2<unsigned char>();

return 0;
}

猜你喜欢

转载自javaeye-hanlingbo.iteye.com/blog/2412498