[ create a new paste ] login | about

Link: http://codepad.org/QU3FhSRH    [ raw code | output | fork ]

C++, pasted on Apr 23:
#include <iostream>

template<typename T> struct Bar_common {
    static void common() {
        std::cout << "come on\n";
    }
};

template<typename T> struct Bar : Bar_common<T> {
    static void hi() {
        std::cout << "hi!\n";
    }
};

struct DummyT {};

template<> struct Bar<DummyT> : Bar_common<DummyT> {};

int main() {
    Bar<int>::common();
    Bar<int>::hi();
    Bar<DummyT>::common();
    //Bar<DummyT>::hi();
}


Output:
1
2
3
come on
hi!
come on


Create a new paste based on this one


Comments: