Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

c++ templated methods

Name: Anonymous 2007-10-07 1:33

How to write implementation of method foo?


template <class T>
class Foo
{
public:
    Foo(void){}
    ~Foo(void){}
    template<class T1> void test(T1 a);
};

Name: Anonymous 2007-10-07 4:21

>>1
#include <iostream>

template < class T >
struct Foo {
        template < class T1 >
        void bar( T1 arg );
};

template < class T >
template < class T1 >
void Foo<T>::bar( T1 arg ) {
        std::cout << arg << std::endl;
}

int main( int argc, char* argv[] ) {
        Foo< int > foo;
        foo.bar( "y halo thar" );

        return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List