GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


templates :( by godecho
1
 
#include <iostream>
using namespace std;

template <unsigned int N, typename Hurf>
class Foo
{
    public:

        void function();
};

template <unsigned int N, typename Hurf>
void Foo<N, Hurf>::function()
{
    cout << "generic: " << N << endl;
}

template <typename Hurf>
void Foo<9, Hurf>::function()
{
    cout << "this doesnt compile :(" << endl;
}

int main(int argc, char** argv)
{
    Foo<3, int> foo1;
    Foo<9, int> foo2;

    foo1.function();
    foo2.function();

    return 0;
}