BG> Is this valid C++ code? And would identifier "qwe" in the
BG> bizarre definition of foo() refer to ::qwe or bar::qwe
BG> (illegal anyway)?
BG> int qwe;
BG> int foo();
BG> class bar {
BG> public:
BG> int qwe;
BG> int ::foo() {return qwe;}
BG> };
Try like this:
#include
#include
int qwe = 1;
int foo() { return qwe; }
class Scopetest {
public:
Scopetest();
int foo() { return qwe; }
int foofoo() { return ::foo(); }
int foofoofoo() { return ::qwe; }
private:
int qwe;
};
Scopetest::Scopetest() { qwe = 2; }
int main(void)
{
Scopetest test;
cout << "\nGlobal : " << foo()
<< "\nClass : " << test.foo()
<< "\nGClass : " << test.foofoo()
<< "\nCGlobl : " << test.foofoofoo()
<< endl;
getch();
return 0;
}
> ] By tomorrow, this will all seem like a dream................
---
---------------
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)
|