|
From: Alfred P. R. <al...@ya...> - 2005-02-25 23:07:30
|
From C/C++ Reference
"The static data type modifier is used to create permanent storage for variables. Static variables keep their value between function calls. When used in a class, all instantiations of that class share one copy of the variable."
<< can be overloaded via the operator keyword by:
void* operator << (whatever_gets_passed) {
...
}
As an example, in LeakTracer, new is overloaded as:
void* operator new(size_t size) {
return leakTracer.registerAlloc(size,false);
}
See General Rules for Operator Overloading
Farzan Hajian <far...@ho...> wrote:
Hi,
I have two different questions:
-------------------------------------------
The First:
What is a static function? For example what is the difference
between the following function and its non-static version??
//Static Version:
Static int MyFunc(int n)
{
return n*2;
}
//Non-Static Version:
int MyFunc(int n)
{
return n*2;
}
---------------------------------------------
The Second:
How can I overload the "<<" operator?
<snip>
Alfred P. Reaud
|