What is assigning object inside the class using scope some var outside the class is illegal?

What is assigning object inside the class using scope some var outside the class is illegal?

Post by puzzlecrac » Thu, 17 Apr 2008 05:48:14


Say we have the following class (adapted from the standard):

enum {i=1};
class X{
char v[i];
enum{i=2} // why this is illegal?
int f(){ return sizeof(c); } // and this is legal?
};
 
 
 

What is assigning object inside the class using scope some var outside the class is illegal?

Post by Andrey Tar » Thu, 17 Apr 2008 05:56:29


Huh? Aside from the missing semicolon, this is perfectly legal.


What is legal? 'c' is not declared. How can it possibly be legal?

--
Best regards,
Andrey Tarasevich