andy
|
I often do this:
template >typename T<
void Swap(T& a,T& b)
{
T c;
c=a;
a=b;
b=c;
}
What that means is that the function will work with any two parameters of the same type. The compiler will simply compile one for each type used. It's also quite useful for factory classes, as you can write a single class, and use it for any number of different types.
Templates mean less code doing more work, which is Really Fricking Cool. ^_~
As for Java being portable, yes. It's possible to write unportable Java, though, (through native hooks and such) and it's possible to write portable C++.
"Ignorance is its own reward" -- Proverb
Posted on 2001-08-23 18:45:32
|
SmokeDog
|
I really need to learn more. Problem is, I only really use Java, Kornshell and all kinds of html/javascript, so that doesn't leave me any time to play with c++, which I would like to do.
Java does rock though, no-one can deny that.
Posted on 2001-08-23 23:38:55
|