Top.Mail.Ru
The C++ Community's Journal -- Day
? ?
The C++ Community's Journal -- Day [entries|friends|calendar]
The C++ Community

[ userinfo | livejournal userinfo ]
[ calendar | livejournal calendar ]

Function templates inside of a class [08 Jan 2005|10:59pm]
[ mood | Image confused ]

First off, hi, I'm new, nice to meet you, blah, blah, blah...

Now, say I have a class foo, and I want to define a function template inside that class, bar, how would I go about doing that? (I hope that made sense, but in case it didn't...)

So, for example say foo is defined as follows:

class foo {
private: ...
public: ...
void bar(float a);
void bar(int a);
void bar(short a);
...
};

In normal circumstances, I could make the function bar a template using

template < class T > //using the spaces, because LJ thinks those are HTML tags...
void bar(T a) {...}

how would I implement that inside of a class?

Any help appreciated, thanks.

12 comments|post comment

navigation
[ viewing | January 8th, 2005 ]
[ go | previous day|next day ]
Image