E
exits funnel
Hello,
I'm confused by the use of the Scope resolution operator on the
indicated lines in the following code (which was copied from Thinking in
C++ by Bruce Eckel). Removing them seems to have no effect.
//Begin Code
#include <new> // Size_t definition
#include <fstream>
using namespace std;
class Widget {
enum { sz = 10 };
int i[sz];
public:
Widget() { }
~Widget() { }
void* operator new(size_t sz) {
return ::new char[sz]; //I'm confused here
}
void operator delete(void* p) {
::delete []p; //and here
}
void* operator new[](size_t sz) {
return ::new char[sz];// and here
}
void operator delete[](void* p) {
::delete []p; //yup, here as well.
}
};
int main() { }
//END Code
Thanks in advance for any replies!
-exits
I'm confused by the use of the Scope resolution operator on the
indicated lines in the following code (which was copied from Thinking in
C++ by Bruce Eckel). Removing them seems to have no effect.
//Begin Code
#include <new> // Size_t definition
#include <fstream>
using namespace std;
class Widget {
enum { sz = 10 };
int i[sz];
public:
Widget() { }
~Widget() { }
void* operator new(size_t sz) {
return ::new char[sz]; //I'm confused here
}
void operator delete(void* p) {
::delete []p; //and here
}
void* operator new[](size_t sz) {
return ::new char[sz];// and here
}
void operator delete[](void* p) {
::delete []p; //yup, here as well.
}
};
int main() { }
//END Code
Thanks in advance for any replies!
-exits