why local class cannot have static member?
Printable View
why local class cannot have static member?
....because: Local classes don't have any linkage (neither internal nor external). However they can access static variables defined in the enclosing scope. You may want to have a look at this - Local Classes. Hope this helps. Regards.Quote:
Originally Posted by ksrameshkanth
Actually local classes are "disposable classes", we use a local class to define a function object that is accessible only from within its scope. so its pointless to allow static variables in disposable class.Quote:
Originally Posted by MSDN