TITLE: Method name scoping example [ This example illustrates a very general concept missed by many new C++ programmers. -adc ] PROBLEM: davidm@consilium.com (David S. Masterson) 4 class alpha { 8 public: 9 ~alpha() {} 14 private: 15 alpha(int i = 0) : x(i) {} [ void* copy() { return new alpha; } The above line was missing from the posting. I tried to reconstruct a line which would show the same problem. -adc ] ===1> 153: Error: Could not find a match for alpha::operator new(unsigned int) 16 void* operator new(size_t sz, void* tmp) 17 { return ::new char[sz]; } 19 }; RESPONSE: gs4t@virginia.edu (Gnanasekaran Swaminathan), 22 Sep 92 This exact case is discussed in an example in p282 of ARM. RESPONSE: davidm@consilium.com (David S. Masterson) Ah, yes. What I don't understand, though, is why the above 'new' definition hides the standard global 'new' definition. The function signature doesn't seem the same to me. RESPONSE: gs4t@virginia.edu (Gnanasekaran Swaminathan) For the same reason as to why the following example doesn't work. void f(int) {} // f(int) is in global scope struct A { static void f(int b, int c) {} // hide ::f int a() { f(10); // error as ::f(int) is hidden ::f(10); // ok f(10, 20); // A::f(int, int) } }; ARM p.15 says, "A name may be hidden by an explicit declaration of that same name in an enclosed block or in a class." Hence, in your case, by declaring alpha::operator new(size_t, void*) you have hidden ::operator new(size_t)